Skip to content

Commit

Permalink
Merge pull request #19 from Financial-Times/wheresrhys-patch-1
Browse files Browse the repository at this point in the history
more sensible error logging
  • Loading branch information
wheresrhys authored Jul 15, 2016
2 parents 3ab6b7a + 00bc58b commit 6aa4cfe
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,19 @@ function request(url){

}).catch(function(e) {
var message = e.message || "";
if (message.indexOf('timed out') > -1 || message.indexOf('Network request failed') > -1) {
// HTTP timeouts are a fact of life on the internet.
if (message.indexOf('timed out') > -1 || message.indexOf('Network request failed') > -1 || message.indexOf('Not Found') > -1) {
// HTTP timeouts and invalid sessions are a fact of life on the internet.
// We don't want to report this to Sentry.
} else {
setTimeout(function() {
throw e;
}, 0);
document.body.dispatchEvent(new CustomEvent('oErrors.log', {
bubbles: true,
detail: {
error: e,
info: {
component: 'next-session-client'
}
}
}))
}
});
}
Expand Down

0 comments on commit 6aa4cfe

Please sign in to comment.