[whatwg] window.onerror -ancient feature needs upgrade

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.

Received on Saturday, 22 September 2007 13:55:17 UTC