Skip to content

Instantly share code, notes, and snippets.

@ngauthier
Created October 29, 2018 20:26
Show Gist options
  • Save ngauthier/ef29d4254f3c6aeab9c311d0e432ba24 to your computer and use it in GitHub Desktop.
Save ngauthier/ef29d4254f3c6aeab9c311d0e432ba24 to your computer and use it in GitHub Desktop.
(function() {
window.onerror = function(message, url, line, column) {
if (typeof url === "undefined" || url === null || url === "") {
return;
}
var data = JSON.stringify({
message: message,
url: url,
line: line,
column: column
});
var xhr = new XMLHttpRequest();
xhr.open("POST", "/i/js-error");
xhr.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
xhr.send(data);
};
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment