Gaëtan Renaudeau
7 years ago
13 changed files with 83 additions and 58 deletions
@ -1,7 +0,0 @@ |
|||
const { SENTRY_URL } = process.env |
|||
|
|||
if (__PROD__ && SENTRY_URL) { |
|||
// const Raven = require('raven')
|
|||
// const ravenConfig = { captureUnhandledRejections: true }
|
|||
// Raven.config(SENTRY_URL, ravenConfig).install()
|
|||
} |
@ -1,19 +1,14 @@ |
|||
const Raven = require('raven-js') |
|||
require('../env') |
|||
|
|||
import { ipcRenderer } from 'electron' |
|||
import { sentryLogsBooleanSelector } from 'reducers/settings' |
|||
|
|||
const { SENTRY_URL } = process.env |
|||
|
|||
let isSentryInstalled = false |
|||
|
|||
export default store => next => action => { |
|||
next(action) |
|||
if (__PROD__ && SENTRY_URL) { |
|||
const state = store.getState() |
|||
const sentryLogs = sentryLogsBooleanSelector(state) |
|||
// if (sentryLogs !== isSentryInstalled) {
|
|||
//
|
|||
// }
|
|||
const state = store.getState() |
|||
const sentryLogs = sentryLogsBooleanSelector(state) |
|||
if (sentryLogs !== isSentryInstalled) { |
|||
isSentryInstalled = sentryLogs |
|||
ipcRenderer.send('sentryLogsChanged', { value: sentryLogs }) |
|||
} |
|||
} |
|||
|
@ -1,14 +1,3 @@ |
|||
require('@babel/polyfill') |
|||
|
|||
const Raven = require('raven-js') |
|||
|
|||
require('../env') |
|||
|
|||
const { SENTRY_URL } = process.env |
|||
|
|||
if (__PROD__ && SENTRY_URL) { |
|||
// Raven.config(SENTRY_URL, { allowSecretKey: true }).install()
|
|||
// window.addEventListener('unhandledrejection', event => Raven.captureException(event.reason))
|
|||
} |
|||
|
|||
require('./init') |
|||
|
@ -1,19 +0,0 @@ |
|||
const Raven = require('raven-js') |
|||
require('../../env') |
|||
import user from 'helpers/user' |
|||
|
|||
const { SENTRY_URL } = process.env |
|||
|
|||
export default shouldSendCallback => { |
|||
Raven.config(SENTRY_URL, { |
|||
allowSecretKey: true, |
|||
release: __APP_VERSION__, |
|||
environment: __DEV__ ? 'development' : 'production', |
|||
shouldSendCallback, |
|||
}) |
|||
.setUserContext({ |
|||
ip_address: null, |
|||
id: user().id, |
|||
}) |
|||
.install() |
|||
} |
@ -0,0 +1,9 @@ |
|||
// @flow
|
|||
|
|||
import Raven from 'raven-js' |
|||
import user from 'helpers/user' |
|||
import install from './install' |
|||
|
|||
export default (shouldSendCallback: () => boolean) => { |
|||
install(Raven, shouldSendCallback, user().id) |
|||
} |
@ -0,0 +1,26 @@ |
|||
// @flow
|
|||
|
|||
require('../env') |
|||
|
|||
const { SENTRY_URL } = process.env |
|||
|
|||
export default (Raven: any, shouldSendCallback: () => boolean, userId: string) => { |
|||
if (!SENTRY_URL) return |
|||
let r = Raven.config(SENTRY_URL, { |
|||
captureUnhandledRejections: true, |
|||
allowSecretKey: true, |
|||
release: __APP_VERSION__, |
|||
environment: __DEV__ ? 'development' : 'production', |
|||
shouldSendCallback, |
|||
}) |
|||
const user = { |
|||
ip_address: null, |
|||
id: userId, |
|||
} |
|||
if (r.setUserContext) { |
|||
r = r.setUserContext(user) |
|||
} else if (r.setContext) { |
|||
r = r.setContext({ user }) |
|||
} |
|||
r.install() |
|||
} |
@ -0,0 +1,8 @@ |
|||
// @flow
|
|||
|
|||
import Raven from 'raven' |
|||
import install from './install' |
|||
|
|||
export default (shouldSendCallback: () => boolean, userId: string) => { |
|||
install(Raven, shouldSendCallback, userId) |
|||
} |
Loading…
Reference in new issue