问题
How can I break on error?
I have a code:
throw new Error("Some error");
And I'm using most recent version of Web Inspector (Webkit) and Firebug(Mozilla). These tools catch and print the error, but does not break. May I don't know the how to. Please let me know how can I to do these?
回答1:
In WebKit you need to click this to enable break on error. If you click it again it will also break on warnings and clicking it again will disable it.
alt text http://a.yfrog.com/img832/3580/screenshot20100723at101.png
回答2:
I redefined Error to get solution.
var Error = function(v)
{
console.trace();
console.debug(v);
}
This solved my problem.
来源:https://stackoverflow.com/questions/3315675/how-can-i-get-break-on-runtime-exceptionor-error-in-javascript-or-ecmascript