mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-30 10:56:53 -05:00
Tweaked the error middleware to proxy and be silent about client errors.
This commit is contained in:
parent
912df310a2
commit
42c7fca055
1 changed files with 4 additions and 1 deletions
|
@ -42,7 +42,10 @@ developmentLogging = (tokens, req, res) ->
|
||||||
setupErrorMiddleware = (app) ->
|
setupErrorMiddleware = (app) ->
|
||||||
app.use (err, req, res, next) ->
|
app.use (err, req, res, next) ->
|
||||||
if err
|
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}"
|
message = "Express error: #{req.method} #{req.path}: #{err.message}"
|
||||||
log.error "#{message}, stack: #{err.stack}"
|
log.error "#{message}, stack: #{err.stack}"
|
||||||
hipchat.sendTowerHipChatMessage(message)
|
hipchat.sendTowerHipChatMessage(message)
|
||||||
|
|
Loading…
Reference in a new issue