Skip to content

Instantly share code, notes, and snippets.

@Tom910
Created January 7, 2018 20:20
Show Gist options
  • Save Tom910/16b0e6a686864292bdf25e2e34955dd7 to your computer and use it in GitHub Desktop.
Save Tom910/16b0e6a686864292bdf25e2e34955dd7 to your computer and use it in GitHub Desktop.
window.onerror = function(message, file, line, column, error) {
var errorToReport = {
type: error ? error.type : '',
message: message,
file: file,
line: line,
column: column,
stack: error ? error.stack : '',
userAgent: navigator.userAgent,
href: location.href
};
var url = '/error-reporting?error=' +
JSON.stringify(errorToReport);
var image = new Image();
image.src = url;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment