From 1a9748667daca9db496fe0090f6086b095cb5def Mon Sep 17 00:00:00 2001 From: Jenny Pollack Date: Thu, 19 Jul 2018 02:22:56 -0400 Subject: [PATCH 1/2] sentry - add detection for Brave Browser --- app/scripts/background.js | 6 ++++-- app/scripts/lib/setupRaven.js | 9 +++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/app/scripts/background.js b/app/scripts/background.js index 1479d9f72..4f877af57 100644 --- a/app/scripts/background.js +++ b/app/scripts/background.js @@ -27,6 +27,7 @@ const EdgeEncryptor = require('./edge-encryptor') const getFirstPreferredLangCode = require('./lib/get-first-preferred-lang-code') const getObjStructure = require('./lib/getObjStructure') const ipfsContent = require('./lib/ipfsContent.js') +const assert = require('assert') const { ENVIRONMENT_TYPE_POPUP, @@ -44,8 +45,9 @@ const notificationManager = new NotificationManager() global.METAMASK_NOTIFIER = notificationManager // setup sentry error reporting -const release = platform.getVersion() -const raven = setupRaven({ release }) +const releaseVersion = platform.getVersion() +const raven = setupRaven({ releaseVersion }) +assert.equal('test', 'notest') // browser check if it is Edge - https://stackoverflow.com/questions/9847580/how-to-detect-safari-chrome-ie-firefox-and-opera-browser // Internet Explorer 6-11 diff --git a/app/scripts/lib/setupRaven.js b/app/scripts/lib/setupRaven.js index 3f69fb3bb..683ab52df 100644 --- a/app/scripts/lib/setupRaven.js +++ b/app/scripts/lib/setupRaven.js @@ -8,8 +8,10 @@ module.exports = setupRaven // Setup raven / sentry remote error reporting function setupRaven (opts) { - const { release } = opts + const { releaseVersion } = opts let ravenTarget + // detect brave + const isBrave = Boolean(window.chrome.ipcRenderer) if (METAMASK_DEBUG) { console.log('Setting up Sentry Remote Error Reporting: DEV') @@ -20,10 +22,13 @@ function setupRaven (opts) { } const client = Raven.config(ravenTarget, { - release, + releaseVersion, transport: function (opts) { + opts.data.extra.isBrave = isBrave const report = opts.data + try { + console.log('testing opts in transport sentry') // handle error-like non-error exceptions rewriteErrorLikeExceptions(report) // simplify certain complex error messages (e.g. Ethjs) From 16fc7efef17aa9579f6b7ac8fe33026511301f20 Mon Sep 17 00:00:00 2001 From: Jenny Pollack Date: Thu, 19 Jul 2018 09:59:58 -0400 Subject: [PATCH 2/2] remove local tests --- app/scripts/background.js | 2 -- app/scripts/lib/setupRaven.js | 1 - 2 files changed, 3 deletions(-) diff --git a/app/scripts/background.js b/app/scripts/background.js index 4f877af57..e07b6b38a 100644 --- a/app/scripts/background.js +++ b/app/scripts/background.js @@ -27,7 +27,6 @@ const EdgeEncryptor = require('./edge-encryptor') const getFirstPreferredLangCode = require('./lib/get-first-preferred-lang-code') const getObjStructure = require('./lib/getObjStructure') const ipfsContent = require('./lib/ipfsContent.js') -const assert = require('assert') const { ENVIRONMENT_TYPE_POPUP, @@ -47,7 +46,6 @@ global.METAMASK_NOTIFIER = notificationManager // setup sentry error reporting const releaseVersion = platform.getVersion() const raven = setupRaven({ releaseVersion }) -assert.equal('test', 'notest') // browser check if it is Edge - https://stackoverflow.com/questions/9847580/how-to-detect-safari-chrome-ie-firefox-and-opera-browser // Internet Explorer 6-11 diff --git a/app/scripts/lib/setupRaven.js b/app/scripts/lib/setupRaven.js index 683ab52df..e657e278f 100644 --- a/app/scripts/lib/setupRaven.js +++ b/app/scripts/lib/setupRaven.js @@ -28,7 +28,6 @@ function setupRaven (opts) { const report = opts.data try { - console.log('testing opts in transport sentry') // handle error-like non-error exceptions rewriteErrorLikeExceptions(report) // simplify certain complex error messages (e.g. Ethjs)