My project which contains a lot of pages with forms. This is a backend of banking CRM system, so any error during working process is to be captured and investigated. On the
Atatus captures JavaScript errors and also captures the user actions that preceded the error. This would help in better understanding of the error. Atatus helps you in monitoring your frontend, not just for errors, but also its performance(Real User Monitoring)
https://www.atatus.com/
Disclaimer: I’m a web developer at Atatus.
If your website is using Google Analytics, you can do what I do:
window.onerror = function(message, source, lineno, colno, error) {
if (error) message = error.stack;
ga('send', 'event', 'window.onerror', message, navigator.userAgent);
}
A few comments on the code above:
Once the code is in place, this is how you view your users' Javascript errors:
Behavior
section and then the Top Events
report.window.onerror
in the list.Secondary dimension
button and entering Event Label
in the textbox that appears.Disclaimer: I'm CEO and creator of Sentry, an open source and paid service which does crash reporting for many languages, including Javascript.
It can be pretty challenging to capture frontend exceptions. Technology has gotten better (browser JS engines), but there's still a lot of limitations.
window.onerror
for various reasons (mostly because browsers historically give bad information here). What we do in the raven.js client (which is based on TraceKit) is patch a number of functions to wrap them in try/catch statements. For example, window.setTimeout
. With this we're able to install error handlers that will generate full stacktraces in most browsers.Some things you should be aware of on the server:
If you want to do painless implementation just put up this guys javascript code in your app. Else If you want to implement one, then try this to get the stacktrace on window
error
and you can use ajax
to report the errors. A nice way to track errors reported by olark
http://exceptionhub.com Should to the trick. http://errorception.com/ Does not provide as much information for debugging, but also seems nice.
proxino don't seem to know what they are doing, they where incuding a complete jQuery in their logger code to log onerror events last time i checked. I wouldn't trust a service that has so little grasp of client side JavaScript to log my JavaScript errors.
Look into window.onerror
. If you want to capture any errors, and report them to the server, then you could try an AJAX request, perhaps.
window.onerror = function(errorMessage, errorUrl, errorLine) {
jQuery.ajax({
type: 'POST',
url: 'jserror.jsf',
data: {
msg: errorMessage,
url: errorUrl,
line: errorLine
},
success: function() {
if (console && console.log) {
console.log('JS error report successful.');
}
},
error: function() {
if (console && console.error) {
console.error('JS error report submission failed!');
}
}
});
// Prevent firing of default error handler.
return true;
}