Created
September 28, 2012 15:47
-
-
Save ManInTheBox/3800622 to your computer and use it in GitHub Desktop.
onerror handler
This file contains 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
(function() { | |
var oldErrorHandler = window.onerror; | |
window.onerror = function(errorMsg, file, line) { | |
var e = encodeURIComponent; | |
if (oldErrorHandler) { | |
oldErrorHandler(errorMsg, file, line); | |
} | |
(new Image()).src = '/njl/log?msg=' + e(errorMsg) + '&level=error' + '&context[file]=' + e(file) + '&context[line]=' + e(line) + '&context[browser]=' + e(navigator.userAgent) + '&context[page]=' + e(document.location.href); | |
}; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment