Skip to content

Instantly share code, notes, and snippets.

@codescribler
Created August 13, 2013 10:10
Show Gist options
  • Save codescribler/6219793 to your computer and use it in GitHub Desktop.
Save codescribler/6219793 to your computer and use it in GitHub Desktop.
A javascript function to hook up the on error event to post the error to my server side logger.
<script>
window.onerror = function (errorText, url, lineNumber) {
var report = {
errorText: errorText,
url: url,
lineNumber: lineNumber
};
$.ajax({
type: "POST",
url: "/error/record",
dataType: 'json',
data: report,
cache: false
});
};
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment