Преглед изворни кода

add error check into health check

Henry Oswald пре 10 година
родитељ
комит
b872fbee32
1 измењених фајлова са 2 додато и 1 уклоњено
  1. 2 1
      services/spelling/app/coffee/HealthCheckController.coffee

+ 2 - 1
services/spelling/app/coffee/HealthCheckController.coffee

@@ -12,7 +12,8 @@ module.exports =
 				language: "en"
 			timeout: 1000 * 20
 		request.post opts, (err, response, body)->
-			console.log body?.misspellings?[0]?.suggestions.length
+			if err?
+				return res.sendStatus 500
 			numberOfSuggestions = body?.misspellings?[0]?.suggestions?.length
 			if numberOfSuggestions > 10
 				logger.log "health check passed"