1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00

Update to use @sentry/browser, remove raven-js (#5253)

This commit is contained in:
Arek Mytych 2018-09-22 14:22:24 +02:00 committed by Tim Neutkens
parent e892898dfe
commit 5276734535
2 changed files with 11 additions and 6 deletions

View file

@ -8,9 +8,9 @@
},
"dependencies": {
"next": "latest",
"raven-js": "^3.19.1",
"react": "^16.0.0",
"react-dom": "^16.0.0"
"@sentry/browser": "^4.0.4",
"react": "^16.5.2",
"react-dom": "^16.5.2"
},
"license": "ISC"
}

View file

@ -1,16 +1,21 @@
import App from 'next/app'
import Raven from 'raven-js'
import * as Sentry from '@sentry/browser'
const SENTRY_PUBLIC_DSN = ''
export default class MyApp extends App {
constructor (...args) {
super(...args)
Raven.config(SENTRY_PUBLIC_DSN).install()
Sentry.init({dsn: SENTRY_PUBLIC_DSN})
}
componentDidCatch (error, errorInfo) {
Raven.captureException(error, { extra: errorInfo })
Sentry.configureScope(scope => {
Object.keys(errorInfo).forEach(key => {
scope.setExtra(key, errorInfo[key])
})
})
Sentry.captureException(error)
// This is needed to render errors correctly in development / production
super.componentDidCatch(error, errorInfo)