If I throw a Javascript exception myself (eg, throw "AArrggg"
), how can I get the stack trace (in Firebug or otherwise)? Right now I just get the message.
edit: As many people below have posted, it is possible to get a stack trace for a JavaScript exception but I want to get a stack trace for my exceptions. For example:
function foo() {
bar(2);
}
function bar(n) {
if (n < 2)
throw "Oh no! 'n' is too small!"
bar(n-1);
}
When foo
is called, I want to get a stack trace which includes the calls to foo
, bar
, bar
.