Adding Sentry/Raven for error tracking

This commit is contained in:
James Barnsley
2017-09-19 16:57:59 +12:00
parent 3844fca6db
commit 50f3d508bc
10 changed files with 99 additions and 16 deletions

View File

@ -1,4 +1,5 @@
var coreActions = require('../../services/core/actions')
var uiActions = require('../../services/ui/actions')
var mopidyActions = require('../../services/mopidy/actions')
var lastfmActions = require('../../services/lastfm/actions')
@ -64,14 +65,20 @@ const sendRequest = ( dispatch, getState, endpoint, method = 'GET', data = false
status = response.error.status
}
dispatch(coreActions.handleException(
message,
{
config: config,
response: response
}
))
// TODO: Instead of allowing request to fail before renewing the token, once refreshed
// we should retry the original request(s)
if (message == 'The access token expired'){
dispatch(refreshToken(dispatch, getState))
}
dispatch(uiActions.createNotification(message,'bad'))
console.error( endpoint+' failed', response)
reject(error)
}
)