0

So I have some code that I cannot edit that sometimes errors out due to various reason I cannot control. This can be a failed ajax call (non-jQuery) or simply a function that fails. Is there any way I can do a generic JS error catch (I do use jQuery) if I do not have access to the code that generates them?

naspinski
  • 33,200
  • 34
  • 107
  • 157

1 Answers1

3

Try with onerror

window.onerror = function() {
    alert("error");
};
MazzCris
  • 1,802
  • 1
  • 13
  • 20