lededje
lededje

Reputation: 1869

attaching an event for errors js/jquery

I'm looking for a hook to use whenever an error is fired. I'm aware that you can try/catch but I want something like jQuery's .error but bound to all errors.

Anyone know of anything like this?

Upvotes: 0

Views: 54

Answers (1)

Xotic750
Xotic750

Reputation: 23472

Perhaps this is what you are looking for window.onerror

Summary

An event handler for runtime script errors.

Note that some/many error events do not trigger window.onerror, you have to listen for them specifically.

Upvotes: 1

Related Questions