Explorar o código

add error check into health check

Henry Oswald %!s(int64=10) %!d(string=hai) anos
pai
achega
b872fbee32
Modificáronse 1 ficheiros con 2 adicións e 1 borrados
  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"
 				language: "en"
 			timeout: 1000 * 20
 			timeout: 1000 * 20
 		request.post opts, (err, response, body)->
 		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
 			numberOfSuggestions = body?.misspellings?[0]?.suggestions?.length
 			if numberOfSuggestions > 10
 			if numberOfSuggestions > 10
 				logger.log "health check passed"
 				logger.log "health check passed"