Skip to content

Instantly share code, notes, and snippets.

@neolite
Created October 15, 2015 13:43
Show Gist options
  • Select an option

  • Save neolite/f0861319c29944f0d255 to your computer and use it in GitHub Desktop.

Select an option

Save neolite/f0861319c29944f0d255 to your computer and use it in GitHub Desktop.
logging frontend errors
window.onerror = function(message, url, lineNumber) {
//save error and send to server for example.
// alert(message, url, lineNumber);
$.post('/log_errors', {
message: message,
url: url,
line: lineNumber
}, function(d) {
console.log("error saving complete: " + d);
});
return true;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment