Remove bugsnag (#19)

This commit is contained in:
Manuel Bouza
2019-05-24 13:34:15 +02:00
committed by Tobias Miesel
parent 23c9af90b3
commit fd04d6bf6c
9 changed files with 67 additions and 616 deletions

View File

@@ -1,45 +0,0 @@
import React from "react"
import bugsnag from "@bugsnag/js"
import bugsnagReact from "@bugsnag/plugin-react"
import { includes } from "lodash/fp"
function getAppVersion() {
try {
return chrome.runtime.getManifest().version
} catch (error) {
return
}
}
const filterReport = report => {
const appVersion = getAppVersion()
if (!appVersion) {
return false
}
const scripts = ["background", "content", "options", "popup"].map(
file => `${chrome.extension.getURL(file)}.${appVersion}.js`
)
return scripts.some(script => report.stacktrace.some(includes(script)))
}
// When BUGSNAG_API_KEY is undefined ErrorBoundary should simply render children
let ErrorBoundary = ({ children }) => children
if (process.env.BUGSNAG_API_KEY) {
const bugsnagClient = bugsnag({
apiKey: process.env.BUGSNAG_API_KEY,
appVersion: getAppVersion(),
collectUserIp: false,
beforeSend: filterReport,
releaseStage: process.env.NODE_ENV,
notifyReleaseStages: ["production"]
})
bugsnagClient.use(bugsnagReact, React)
ErrorBoundary = bugsnagClient.getPlugin("react")
}
export { ErrorBoundary }