views:

32

answers:

2

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?

A: 

I redefined Error to get solution.

    var Error   =   function(v)
    {
        console.trace();
        console.debug(v);
    }

This solved my problem.

Eonil
A: 

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

klaaspieter
Wow! This worked! Thanks! Webkit broke, but it does not print the error message until I click the continue button. Is there any way to solve this?
Eonil
I don't think so. It stops execution right before the error, so the error is not printed yet.
klaaspieter