When node encounters an caught exception, it prints the line the error occurred on, followed by the stack trace, then exits:
/example.js:1
throw new Error()
^
Error
at ...
I would like to catch an exception, print exactly the same thing, and continue. Basically:
try {
something();
} catch (e) {
// what goes here?
console.error(e);
}
Note that the above example already prints the stack trace. The missing part is the first four lines, including the file/line reference, line text, and column indicator.