Can a non-string variable get into the window.onerror event handler?

window.onerror = function() { log arguments.m || arguments[0]; } 

I get the log as "[Event of an object]". Can someone tell me why the event object would be sent to the handler? and how can we reproduce or correct it?

and it only comes to web control of the Android device.

Thanks in advance.

+3
javascript android html android-webview
source share
3 answers

You get the error event object as the first argument to the function. The event object contains error information.

0
source share

arguments not determined by how you define the function, but you decide what it is called. When window.onerror is called, event is passed to it as the first parameter. (For non-IE, in IE the event is available for global access).

Example:

 var foo = function() { console.log(arguments[0], arguments[1]); } foo(1,2); // will log 1 and 2 

0
source share

This seems to be just a bug in older Android browsers. See https://github.com/getsentry/raven-js/issues/360

0
source share

All Articles