From 42c7fca05515a40e7f3e0dbc3931697d3280fc93 Mon Sep 17 00:00:00 2001 From: Scott Erickson Date: Sat, 29 Nov 2014 11:05:19 -0800 Subject: [PATCH] Tweaked the error middleware to proxy and be silent about client errors. --- server_setup.coffee | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/server_setup.coffee b/server_setup.coffee index a3f972caa..ad056068b 100644 --- a/server_setup.coffee +++ b/server_setup.coffee @@ -42,7 +42,10 @@ developmentLogging = (tokens, req, res) -> setupErrorMiddleware = (app) -> app.use (err, req, res, next) -> if err - res.status(500).send(error: "Something went wrong!") + if err.status and 400 <= err.status < 500 + res.status(err.status).send("Error #{err.status}") + return + res.status(err.status ? 500).send(error: "Something went wrong!") message = "Express error: #{req.method} #{req.path}: #{err.message}" log.error "#{message}, stack: #{err.stack}" hipchat.sendTowerHipChatMessage(message)