When I run this code:
throw 'a string';
I get this stacktrace on my terminal:
$ node test.js
/home/user/test.js:2
throw 'a string';
^
a string
There is the filename and the line where this exception appeared.
I'm trying to build an exception logging mecanism and when I use the uncaughtException handler, I cannot get the filename nor the line.
process.on('uncaughtException', function() {
console.log(arguments);
});
throw 'a string';
When I run this code I only get:
$ node test2.js
{ '0': 'a string' }
Is is possible to get the filename / line when I use the uncaughtException handler?
Thanks