-
-
Save AshikNesin/6510148ef996aad5a3cb2fec476191cc to your computer and use it in GitHub Desktop.
Capturing Unhandled Exceptions
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
window.onerror = function(message, file, line, column, error) { | |
error = error || {}; | |
$.ajax({ | |
method: 'POST', | |
url: 'https://yourapp.com/path/to/error/log', | |
data: JSON.stringify({ | |
message: message, | |
file: file, | |
line: line, | |
column: column, | |
error: { | |
name: error.name, | |
message: error.message, | |
stack: error.stack | |
} | |
}) | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment