Reputation: 78535
I'm writing a handler for my client-side errors using the onerror
event. What I'm really interested in is the type of Error thrown, as a string.
How can I find this, given the errorObject
in the event handler?
window.onerror = function(errorMsg, url, lineNumber, colNumber, errorObject) {
// ...
};
typeof
- just returns object. I could do instanceof
and hardcode the list of error types from the MDN docs, but that doesn't seem right.
Upvotes: 1
Views: 150