[whatwg] window.onerror -ancient feature needs upgrade

Garrett Smith dhtmlkitchen at gmail.com
Tue Aug 19 19:08:28 PDT 2008

On Tue, Aug 19, 2008 at 6:16 PM, Ian Hickson <ian at hixie.ch> wrote:
> On Sat, 22 Sep 2007, Garrett Smith wrote:
>> window.onerror
>> There needs to be a way to capture errors on the window.
> Is window.onerror not enough?

window.onerror would be sufficient if it:
  * accepted an Error parameter.
  * fired when an EventListener callback had an Error
  * fired when a callback in setTimeout had an Error

But unfortunately, none of the above is true. At least some of it is
true in some browsers.

Accepting an Error parameter is important because it provides standard
information of the Error or Exception. At least one implementation
provides a 'stack' property (Firefox). Another implementation provides
stack info in the error message (Opera).

> Do you mean JS errors or load errors?

A useful global error handler would catch any uncaught, thrown Script
Error or raised DOMException.

What load errors did you have in mind?

> I'm not sure I follow what the problem is here. Is this to aid debugging?

Yes. window.onerror seems useful for testing and debugging but leaves
some to be desired.


> --
> Ian Hickson               U+1047E

More information about the whatwg mailing list