Is it possible to get reports of network errors using Raven? We’ve been running into some 502s with our app and would like to use Sentry to track when this happens.
Assuming these are Ajax calls, you could apply a catch-all and respond to the status code you want to watch for, then just call Raven’s captureMessage.
So something like this, anywhere on your page:
$(document).ready(function(){
$(document).ajaxComplete(function( event, xhr, settings ) {
if (xhr.status === 502)
Raven.captureMessage('Uh oh.')
});
});
Or something similar - I imagine you get the idea though
1 Like
That’s perfect, thanks! To help those in the future, this creates a message that mirrors that of Chrome:
$(document).ajaxComplete(function(e, xhr, settings) {
if (xhr.status >= 500) Raven.captureMessage(
settings.type + ' ' + settings.url + ' ' + xhr.status + ' (' + xhr.statusText + ')'
);
});