add more null checks to health check

This commit is contained in:
Henry Oswald 2015-12-02 10:10:52 +00:00
parent a964119b5e
commit 1541eb319c

View file

@ -28,9 +28,11 @@ module.exports =
if err? if err?
logger.err err:err, "docstore returned a error in health check get" logger.err err:err, "docstore returned a error in health check get"
cb(err) cb(err)
else if !res?
cb("no response from docstore with get check")
else if res?.statusCode != 200 else if res?.statusCode != 200
cb("status code not 200, its #{res.statusCode}") cb("status code not 200, its #{res.statusCode}")
else if _.isEqual(body.lines, lines) and body._id == doc_id.toString() else if _.isEqual(body?.lines, lines) and body?._id == doc_id.toString()
cb() cb()
else else
cb("health check lines not equal #{body.lines} != #{lines}") cb("health check lines not equal #{body.lines} != #{lines}")