From 35e0eafc9573dd3aceb0b22da90d75d00420772b Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Thu, 4 Feb 2016 13:44:17 +0000 Subject: [PATCH] cleaned up health check a little --- .../app/coffee/HealthCheckController.coffee | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/services/notifications/app/coffee/HealthCheckController.coffee b/services/notifications/app/coffee/HealthCheckController.coffee index b41dc0290a..0a82ad4f62 100644 --- a/services/notifications/app/coffee/HealthCheckController.coffee +++ b/services/notifications/app/coffee/HealthCheckController.coffee @@ -26,18 +26,21 @@ module.exports = opts.json = true request.get opts, (err, res, body)-> if res.statusCode != 200 - return cb("status code not 200, its #{res.statusCode}") + e = "status code not 200 #{res.statusCode}" + logger.err err:err, e + return cb(e) hasNotification = _.some body, (notification)-> notification.key == notification_key and notification.user_id == user_id.toString() if hasNotification - cb(null,body) + cb(null, body) else - logger.log body:body, "what is in the body" + logger.log body:body, "got notifications response for health check" return cb("notification not found in response") ] async.series jobs, (err, body)-> if err? + logger.err err:err, "error running health check" return callback(err) else notification_id = body[1][0]._id