Created
November 24, 2015 17:22
-
-
Save sehrgut/caffcf820597f76f6ad4 to your computer and use it in GitHub Desktop.
logs uncaught exceptions which bubble up to window.onerror
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| window.onerror = (function () { | |
| var old_err = window.onerror; | |
| var new_err = function (msg, url, line, col, err) { | |
| console.log("Line " + line + ":" + col + " - " + msg); | |
| if (typeof err.stack !== 'undefined') | |
| console.log(err.stack); | |
| else | |
| console.log(err); | |
| if (old_err) old_err(msg, url, line, col, err); | |
| }; | |
| new_err.detach = function () { window.onerror = old_err; } | |
| return new_err; | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment