[whatwg] window.onerror -ancient feature needs upgrade

Garrett Smith dhtmlkitchen at gmail.com
Sat Sep 22 13:55:17 PDT 2007


window.onerror

There needs to be a way to capture errors on the window.

A method that passes an Error to the handler. One possible solution
would be to leverage the existing event system:

addEventListener( "error", genericErrorEventHandler, false );

function genericErrorEventHandler( errorEvent ) {
   // What is the argument here?
   var error = errorEvent.error;
};

Grabbing the Error instance off the event seems somewhat unintuitive
}E uses that approach.

It also leads to switch statements or too much conditional logic.
I
function genericErrorEventHandler( errorEvent ) {
   // What is the argument here?
   var error = errorEvent.error;
    if( error instanceof EvalError) {

};

Maybe someone has a better idea?.

would be useful to have a method on the global object to catch errors.
addEventListener( "evalerror", genericErrorEventHandler, false );

Garrett

-- 
Programming is a collaborative art.



More information about the whatwg mailing list