In Chrome, when an exception occurs, it prints a stack trace to the console log. This is extremely useful, but unfortunately in cases where an exception has been rethrown th
The best you can do is grab the original stack and print it. I use this in unit testing tools.
try{
...
}
catch(e){
console.log(e.stack);
console.log(e.message);
throw(e);
}
In my situation console.log() was not possible. What I did is:
}catch( error ){
// 'throw' replaces the stack trace.
// To preserve the stack add it to the message.
error.message += '; Stack trace: ' + error.stack;
throw error;
}
This is a known bug in Chrome, and unfortunately there's no workaround that I'm aware of.