Skip to content

Instantly share code, notes, and snippets.



Created Dec 11, 2019
What would you like to do?
Log JS Errors via AJAX
// On error send to backend route which will log error into central logging service.
window.onerror = function(message, file, line) {
method: 'POST',
headers: {
'Content-Type': 'application/json'
body: JSON.stringify({
file: file,
line: line,
message: message,
browser: navigator.userAgent,
url: window.location.href
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.