Guys Я пытаюсь справиться запрос HTTP в CoffeeScript, но в случае, если сервер не приложение просто умирает с ошибкой ниже, и я не могу найти правильное решениеОбработка Http erorrs в CoffeeScript
Код:
http.get "http://localhost:8080/health", (res) ->
status = res.statusCode
value = if status == 200 then 1 else 0
console.log value
server.push_metric metricPrefix , value
res.on 'error',() ->
colsone.log "Tomcat Disconected"
ошибка:
events.js:71
throw arguments[1]; // Unhandled 'error' event
^
Error: connect ECONNREFUSED
at errnoException (net.js:770:11)
at Object.afterConnect [as oncomplete] (net.js:761:19)