diff options
-rw-r--r-- | app/scripts/background.js | 11 | ||||
-rw-r--r-- | app/scripts/popup.js | 9 | ||||
-rw-r--r-- | app/scripts/setupRaven.js | 24 |
3 files changed, 35 insertions, 9 deletions
diff --git a/app/scripts/background.js b/app/scripts/background.js index ddd1f5b4f..8c1252d3e 100644 --- a/app/scripts/background.js +++ b/app/scripts/background.js @@ -12,11 +12,8 @@ const migrations = require('./migrations/') const PortStream = require('./lib/port-stream.js') const NotificationManager = require('./lib/notification-manager.js') const MetamaskController = require('./metamask-controller') -const firstTimeState = require ('./first-time-state') -const Raven = require('./vendor/raven.min.js') - -// Setup raven / sentry remote error reporting -Raven.config('https://3567c198f8a8412082d32655da2961d0@sentry.io/273505').install() +const firstTimeState = require('./first-time-state') +const setupRaven = require('./setupRaven') const STORAGE_KEY = 'metamask-config' const METAMASK_DEBUG = 'GULP_METAMASK_DEBUG' @@ -28,6 +25,10 @@ const platform = new ExtensionPlatform() const notificationManager = new NotificationManager() global.METAMASK_NOTIFIER = notificationManager +// setup sentry error reporting +const release = platform.getVersion() +setupRaven({ release }) + let popupIsOpen = false // state persistence diff --git a/app/scripts/popup.js b/app/scripts/popup.js index 4d5f40853..860cc567d 100644 --- a/app/scripts/popup.js +++ b/app/scripts/popup.js @@ -7,14 +7,15 @@ const extension = require('extensionizer') const ExtensionPlatform = require('./platforms/extension') const NotificationManager = require('./lib/notification-manager') const notificationManager = new NotificationManager() -const Raven = require('./vendor/raven.min.js') - -// Setup raven / sentry remote error reporting -Raven.config('https://3567c198f8a8412082d32655da2961d0@sentry.io/273505').install() +const setupRaven = require('./setupRaven') // create platform global global.platform = new ExtensionPlatform() +// setup sentry error reporting +const release = global.platform.getVersion() +setupRaven({ release }) + // inject css const css = MetaMaskUiCss() injectCss(css) diff --git a/app/scripts/setupRaven.js b/app/scripts/setupRaven.js new file mode 100644 index 000000000..4888c85fe --- /dev/null +++ b/app/scripts/setupRaven.js @@ -0,0 +1,24 @@ +const Raven = require('./vendor/raven.min.js') +const METAMASK_DEBUG = 'GULP_METAMASK_DEBUG' +const PROD = 'https://3567c198f8a8412082d32655da2961d0@sentry.io/273505' +const DEV = 'https://f59f3dd640d2429d9d0e2445a87ea8e1@sentry.io/273496' + +module.exports = setupRaven + +// Setup raven / sentry remote error reporting +function setupRaven(opts) { + const { release } = opts + let ravenTarget + + if (METAMASK_DEBUG) { + console.log('Setting up Sentry Remote Error Reporting: DEV') + ravenTarget = DEV + } else { + console.log('Setting up Sentry Remote Error Reporting: PROD') + ravenTarget = PROD + } + + Raven.config(ravenTarget, { + release, + }).install() +} |