-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.ts
More file actions
28 lines (25 loc) Β· 898 Bytes
/
Copy pathindex.ts
File metadata and controls
28 lines (25 loc) Β· 898 Bytes
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
import { registerRootComponent } from 'expo';
import App from './App';
// Global error handler to ensure mobile errors show up in terminal
if (__DEV__) {
// 1. Handle JS Errors
const globalAny: any = global;
if (globalAny.ErrorUtils) {
const originalHandler = globalAny.ErrorUtils.getGlobalHandler();
globalAny.ErrorUtils.setGlobalHandler((error: any, isFatal: boolean) => {
console.error('π΄ GLOBAL JS ERROR:', error);
if (originalHandler) {
originalHandler(error, isFatal);
}
});
}
// 2. Handle Unhandled Promise Rejections
const promise = require('promise/lib/rejection-tracking');
promise.enable({
all: true,
onUnhandled: (id: any, error: any) => {
console.error('π‘ UNHANDLED PROMISE REJECTION:', error);
},
});
}
registerRootComponent(App);