Window.onerror does not catch DOMException

I am running angularjs app in chrome browser and want to log all errors that are thrown. I use the following for this:

window.onerror = function(message, url, linenumber) {
        alert("JavaScript error: " + message + " on line " + linenumber + " for " + url);
        log.error("JavaScript error: " + message + " on line " + linenumber + " for " + url);
    }

      

It seems to work fine for any js errors, however it fails for the following:

Error: TYPE_MISMATCH_ERR: DOM Exception 17 Error: The object type is incompatible with the expected parameter type associated with the object.

ReferenceError: socket not defined

Any ideas?

+3


source to share





All Articles