Reputation: 2214
Some of our customers are reporting that they are unable to execute some javascript actions. Our error data collecting is on the server and when javascript breaks we are unable to get notified it since ajax calls can't be run before page refresh.
Is there a way to collect javascript errors on client side and send them to the server as soon as javascript is running fine again.
Example:
Upvotes: 1
Views: 294
Reputation: 700342
There is no need to refresh the page to make AJAX calls. You just need to make sure that the error handling code is in its own script tag so that it won't break if there is a syntax error in the other code.
Here is part of the code that we are using to catch script errors and send them to the server (The AJAX code is in a separate method, but I trust that you already know how to do that):
window.onerror = function (message, url, line, column) {
Ajax.logError(message, url, line, column);
$('body').append($('<div>').addClass('ErrorPanel').text('An error occured in the browser.').delay(5000).animate({ height: 0 }, 2000, function() { $(this).remove(); }));
return false;
};
Upvotes: 2
Reputation: 323
Maybe you should take a look at New Relic. New Relic is a monitoring tool for software analysis and it's able to show you various information about JavaScript errors (and much more):
http://newrelic.com/browser-monitoring
Upvotes: -1