mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-30 10:56:53 -05:00
Link to Papertrail logs in error messages
This commit is contained in:
parent
71d7ac5e11
commit
6cb46aafa8
2 changed files with 6 additions and 1 deletions
|
@ -16,6 +16,9 @@ module.exports.sendHipChatMessage = sendHipChatMessage = (message) ->
|
|||
#log.info "Got HipChat patch response:", body
|
||||
|
||||
module.exports.sendTowerHipChatMessage = sendTowerHipChatMessage = (message) ->
|
||||
secondsFromEpoch = Math.floor(new Date().getTime() / 1000)
|
||||
link = "<a href=\"https://papertrailapp.com/groups/488214/events?time=#{secondsFromEpoch}\">PaperTrail</a>"
|
||||
message = "#{message} #{link}"
|
||||
return unless key = config.hipchatTowerAPIKey
|
||||
roomID = 318356
|
||||
form =
|
||||
|
|
|
@ -43,7 +43,9 @@ setupErrorMiddleware = (app) ->
|
|||
app.use (err, req, res, next) ->
|
||||
if err
|
||||
res.status(500).send(error: "Something went wrong!")
|
||||
hipchat.sendTowerHipChatMessage("The server crashed. Path: #{req.path}, Stack trace: <br> <code>#{err.stack}</code>")
|
||||
message = "Express got an error. Path: #{req.path}, message: #{err.message}"
|
||||
log.error "#{message}, stack: #{err.stack}"
|
||||
hipchat.sendTowerHipChatMessage(message)
|
||||
else
|
||||
next(err)
|
||||
setupExpressMiddleware = (app) ->
|
||||
|
|
Loading…
Reference in a new issue