2018-08-04 17:51:35 +00:00
|
|
|
import App from 'next/app'
|
2018-09-22 12:22:24 +00:00
|
|
|
import * as Sentry from '@sentry/browser'
|
2018-08-04 17:51:35 +00:00
|
|
|
|
|
|
|
const SENTRY_PUBLIC_DSN = ''
|
|
|
|
|
|
|
|
export default class MyApp extends App {
|
|
|
|
constructor (...args) {
|
|
|
|
super(...args)
|
2018-09-22 12:22:24 +00:00
|
|
|
Sentry.init({dsn: SENTRY_PUBLIC_DSN})
|
2018-08-04 17:51:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
componentDidCatch (error, errorInfo) {
|
2018-09-22 12:22:24 +00:00
|
|
|
Sentry.configureScope(scope => {
|
|
|
|
Object.keys(errorInfo).forEach(key => {
|
|
|
|
scope.setExtra(key, errorInfo[key])
|
|
|
|
})
|
|
|
|
})
|
|
|
|
Sentry.captureException(error)
|
2018-08-04 17:51:35 +00:00
|
|
|
|
|
|
|
// This is needed to render errors correctly in development / production
|
|
|
|
super.componentDidCatch(error, errorInfo)
|
|
|
|
}
|
|
|
|
}
|