Firebug not showing stack trace for errors?
I have noticed that even with "show stack trace with errors" enabled from the drop down, only errors that occur seem to have traces, but when I do: throw new Error('foo');
I do not see any stack trace for it even though it seems to appear in the console exactly the same way as other errors that occur such as iDoNotExist()
.
Is there something I am missing?
It also seems that I get the stack trace for calling conso开发者_运维百科le.error('foo');
. Odd.
It should be noted that stack traces do occur on Webkit Inspector and Opera when doing throw new Error('foo');
.
For others landing here :
The issue for me was showStackTrace
is set to false by default for Firebug.
Here's how to enable it :
Goto
about:config
in FirefoxChange the value of the preference
extensions.firebug.showStackTrace
fromfalse
totrue
(Double-click toggles the value).
I tested this code in Firebug 1.7.1b2 (FF: 4.0.1, on win7) and it shows me stack trace:
function a(){
throw new Error('s');
};
function b(){
a()
}
b();
Have you tried:
var err = new Error();
err.name = 'My custom error';
err.message = 'foo';
throw(err);
Or even (doesn't always work):
throw 'foo';
throw('foo');
精彩评论