mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-29 14:03:42 -05:00
catch exceptions within the body of the domain error handler
This commit is contained in:
parent
48f62990b4
commit
d3fa6b4a01
1 changed files with 21 additions and 19 deletions
|
@ -37,26 +37,28 @@ app.use (req, res, next) ->
|
||||||
requestDomain.add req
|
requestDomain.add req
|
||||||
requestDomain.add res
|
requestDomain.add res
|
||||||
requestDomain.on "error", (err)->
|
requestDomain.on "error", (err)->
|
||||||
# request a shutdown to prevent memory leaks
|
try
|
||||||
appIsOk = false
|
appIsOk = false
|
||||||
setTimeout(->
|
# request a shutdown to prevent memory leaks
|
||||||
|
beginShutdown()
|
||||||
if !res.headerSent
|
if !res.headerSent
|
||||||
res.send(500)
|
res.send(500, "uncaught exception")
|
||||||
, 3000)
|
logger = require('logger-sharelatex')
|
||||||
logger = require('logger-sharelatex')
|
req =
|
||||||
req =
|
body:req.body
|
||||||
body:req.body
|
headers:req.headers
|
||||||
headers:req.headers
|
url:req.url
|
||||||
url:req.url
|
key: req.key
|
||||||
key: req.key
|
statusCode: req.statusCode
|
||||||
statusCode: req.statusCode
|
err =
|
||||||
err =
|
message: err.message
|
||||||
message: err.message
|
stack: err.stack
|
||||||
stack: err.stack
|
name: err.name
|
||||||
name: err.name
|
type: err.type
|
||||||
type: err.type
|
arguments: err.arguments
|
||||||
arguments: err.arguments
|
logger.err err:err, req:req, res:res, "uncaught exception thrown on request"
|
||||||
logger.err err:err, req:req, res:res, "uncaught exception thrown on request"
|
catch exception
|
||||||
|
logger.err err: exception, "exception in request domain handler"
|
||||||
requestDomain.run next
|
requestDomain.run next
|
||||||
|
|
||||||
app.get "/project/:project_id/file/:file_id", keyBuilder.userFileKey, fileController.getFile
|
app.get "/project/:project_id/file/:file_id", keyBuilder.userFileKey, fileController.getFile
|
||||||
|
|
Loading…
Reference in a new issue