-
Notifications
You must be signed in to change notification settings - Fork 359
/
index.js
36 lines (31 loc) · 1.25 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Order is important, please don't change it unless you know what you're doing :D
import 'node-libs-react-native/globals'
import 'src/missingGlobals'
import 'src/forceCommunityAsyncStorage'
import { AppRegistry } from 'react-native'
import Logger from 'src/utils/Logger'
import App from 'src/app/App'
import { installSentry } from 'src/sentry/Sentry'
import * as Sentry from '@sentry/react-native'
import { onBackgroundNotification } from 'src/firebase/firebase'
// Set this to true, if you are modifying Sentry and want to test your changes
const enableSentryOnDebugBuild = false
const isDevBuild = __DEV__
const sentryEnabled = !isDevBuild || enableSentryOnDebugBuild
if (sentryEnabled) {
installSentry()
} else {
Logger.info('RootErrorHandler', 'Sentry not enabled')
}
Logger.overrideConsoleLogs()
const defaultErrorHandler = ErrorUtils.getGlobalHandler()
const customErrorHandler = (e, isFatal) => {
if (sentryEnabled) {
Sentry.captureException(e)
}
Logger.error('RootErrorHandler', `Unhandled error. isFatal: ${isFatal}`, e)
defaultErrorHandler(e, isFatal)
}
ErrorUtils.setGlobalHandler(customErrorHandler)
AppRegistry.registerComponent('celo', () => App)
AppRegistry.registerHeadlessTask('RNFirebaseBackgroundMessage', () => onBackgroundNotification)