Better reporting of unhandled rejections to sentry

Changelog-entry: Better reporting of unhandled rejections to sentry
Change-type: patch
This commit is contained in:
Alexis Svinartchouk 2019-03-27 19:45:42 +01:00
parent 68fa771905
commit bceb7c77d1

View File

@ -52,7 +52,7 @@ const osDialog = require('./os/dialog')
const exceptionReporter = require('./modules/exception-reporter') const exceptionReporter = require('./modules/exception-reporter')
const updateLock = require('./modules/update-lock') const updateLock = require('./modules/update-lock')
/* eslint-disable lodash/prefer-lodash-method */ /* eslint-disable lodash/prefer-lodash-method,lodash/prefer-get */
// Enable debug information from all modules that use `debug` // Enable debug information from all modules that use `debug`
// See https://github.com/visionmedia/debug#browser-support // See https://github.com/visionmedia/debug#browser-support
@ -62,6 +62,15 @@ const updateLock = require('./modules/update-lock')
process.env.DRIVELIST_DEBUG = /drivelist|^\*$/i.test(process.env.DEBUG) ? '1' : '' process.env.DRIVELIST_DEBUG = /drivelist|^\*$/i.test(process.env.DEBUG) ? '1' : ''
window.localStorage.debug = process.env.DEBUG window.localStorage.debug = process.env.DEBUG
window.addEventListener('unhandledrejection', (event) => {
// Promise: event.reason
// Bluebird: event.detail.reason
// Anything else: event
const error = event.reason || (event.detail && event.detail.reason) || event
analytics.logException(error)
event.preventDefault()
})
// Set application session UUID // Set application session UUID
store.dispatch({ store.dispatch({
type: store.Actions.SET_APPLICATION_SESSION_UUID, type: store.Actions.SET_APPLICATION_SESSION_UUID,