You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Searched both open and closed issues for duplicates of this issue
Title adequately and concisely reflects the feature or the bug
Bug Report
Restify Version
Restify 7.x
Node.js Version
Node 8.11.3
Expected behaviour
Turning on handleUncaughtExceptions should trigger uncaughtException handlers only for thrown exceptions that have not been caught.
Actual behaviour
Other exceptions like next(new Error()) or calling a method (like HEAD) that is not handled by the server trigger the uncaughtExceptions handlers.
Repro case
varrestify=require('./');varserver=restify.createServer({handleUncaughtExceptions: true});server.on('uncaughtException',functionexceptionHandler(req,res,route,err){res.send(500,'foo');});// Hitting this route incorrectly triggers the uncaughtException handlerserver.get('/',functionrootGet(req,res,next){next(newError('Test'));});// Hitting this route correctly triggers the uncaughtException handlerserver.get('/throw',functionthrowGet(req,res,next){thrownewError('Thrown Error');});server.listen(3000);// Hitting `HEAD /` incorrectly triggers the uncaughtException handler with `MethodNotAllowed` error
Cause
The logic for handling errors has been unified between uncaught exceptions and other types of route handling errors, but information on whether an error was uncaught is not retained.
Bug Report
Restify Version
Restify 7.x
Node.js Version
Node 8.11.3
Expected behaviour
Turning on
handleUncaughtExceptions
should triggeruncaughtException
handlers only for thrown exceptions that have not been caught.Actual behaviour
Other exceptions like
next(new Error())
or calling a method (likeHEAD
) that is not handled by the server trigger theuncaughtExceptions
handlers.Repro case
Cause
The logic for handling errors has been unified between uncaught exceptions and other types of route handling errors, but information on whether an error was uncaught is not retained.
Are you willing and able to fix this?
Yes, I have a branch ready at master...mridgway:fixUncaughtExceptionTrigger
The text was updated successfully, but these errors were encountered: