1 | import { Platform } from '@unimodules/core';
|
2 | import { getRecoveryPropsToSave } from './ErroRecoveryStore';
|
3 | import ExpoErrorRecovery from './ExpoErrorRecovery';
|
4 | if (Platform.OS !== 'web') {
|
5 | const globalHandler = ErrorUtils.getGlobalHandler();
|
6 |
|
7 |
|
8 | ErrorUtils.setGlobalHandler(async (error, isFatal) => {
|
9 | if (ExpoErrorRecovery.saveRecoveryProps) {
|
10 | await ExpoErrorRecovery.saveRecoveryProps(getRecoveryPropsToSave());
|
11 | }
|
12 | globalHandler(error, isFatal);
|
13 | });
|
14 | }
|
15 | else if (Platform.OS === 'web' && Platform.isDOMAvailable) {
|
16 | window.addEventListener('error', () => {
|
17 | ExpoErrorRecovery.saveRecoveryProps(getRecoveryPropsToSave());
|
18 | });
|
19 | }
|
20 |
|
\ | No newline at end of file |