I have set up an uncaughtException
event listener in node js:
process.on('uncaughtException', function (err) {
console.log('uncaughtException: ');
console.log(err);
process.exit(1);
});
To test it I tried the following. At one time:
callNonExistantFunction();
And at another:
throw new Error('test error');
In both cases, the exceptions were caught, but the value of the err
parameter in the callback function was an empty object: {}
. Is there any way to get the details of the error? I'm working on a Windows machine if it matters.
Thanks.