UNPKG

904 BJavaScriptView Raw
1import { Platform } from 'expo-modules-core';
2import { getRecoveryPropsToSave } from './ErroRecoveryStore';
3import ExpoErrorRecovery from './ExpoErrorRecovery';
4if (Platform.OS !== 'web') {
5 const globalHandler = ErrorUtils.getGlobalHandler();
6 // ErrorUtils came from react-native
7 // https://github.com/facebook/react-native/blob/1151c096dab17e5d9a6ac05b61aacecd4305f3db/Libraries/vendor/core/ErrorUtils.js#L25
8 ErrorUtils.setGlobalHandler(async (error, isFatal) => {
9 if (ExpoErrorRecovery.saveRecoveryProps) {
10 await ExpoErrorRecovery.saveRecoveryProps(getRecoveryPropsToSave());
11 }
12 globalHandler(error, isFatal);
13 });
14}
15else if (Platform.OS === 'web' && Platform.isDOMAvailable) {
16 window.addEventListener('error', () => {
17 ExpoErrorRecovery.saveRecoveryProps(getRecoveryPropsToSave());
18 });
19}
20//# sourceMappingURL=ErrorRecovery.fx.js.map
\No newline at end of file