Bug Report
It is not clear to me with the current version of restify how to handle runtime errors such as throw new Error(). I tried the following code but it did not catch:
server.on('uncaughtException', (req, res, route, err) => {
err.body = 'i caught it!';
res.send(500,err);
});
Can anyone advise?
Restify Version
5.2.0
Node.js Version
8.1.3
Expected behaviour
service respond 'I caught it'
This section details what you expected restify to do based on the code that you wrote
Actual behaviour
Service stops on runtime error
This section details what restify actually did when you ran your code
Repro case
Please include a simple and concise example reproducing this bug. Please do
not just dump your application here. By either not providing a repro case or
by providing an overly complicated repro case, you are offloading the work of
isolating your bug to other developers, many of which are here voluntarily.
Good repro cases are single file Node.js applications, where the only logic
present is logic necessary to expose the undesired behaviour. You will often
find that when creating your repro case, you will solve the problem yourself!
Cause
If you have been able to trace the bug back to it source(s) in the code base,
please link to them here.
Are you willing and able to fix this?
yes
"Yes" or, if "no", what can current contributors do to help you create a PR?
If this issue is unique, as the checklist you completed above suggests, then
you are one of the few people who have encountered this bug in the wild.
While contributors will often help work on issues out of the kindness of
their hearts, its important to remember that you are the largest stakeholder
in seeing this bug resolved as you are the one experiencing it. Kindness
and contributions are what make Free Software go round, help pay it forward!
Bug Report
It is not clear to me with the current version of restify how to handle runtime errors such as throw new Error(). I tried the following code but it did not catch:
server.on('uncaughtException', (req, res, route, err) => {
err.body = 'i caught it!';
res.send(500,err);
});
Can anyone advise?
Restify Version
5.2.0
Node.js Version
8.1.3
Expected behaviour
service respond 'I caught it'
Actual behaviour
Service stops on runtime error
Repro case
Cause
Are you willing and able to fix this?
yes