Skip to content

Instantly share code, notes, and snippets.

@ngauthier

ngauthier/errors.js

Created Oct 29, 2018
Embed
What would you like to do?
(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