Remove bugsnag (#19)
This commit is contained in:
committed by
Tobias Miesel
parent
23c9af90b3
commit
fd04d6bf6c
@@ -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 }
|
||||
Reference in New Issue
Block a user