0
傢伙我試圖來處理CoffeeScript的HTTP請求,但萬一服務器宕機的應用程序只是錯誤去世下面,我無法找到合適的解決方案處理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)