Fix JS exceptions crashing the app instantly
This commit is contained in:
@@ -9,9 +9,13 @@ import { logger } from './src/services/logger';
|
||||
|
||||
// Set up global error handler
|
||||
const defaultErrorHandler = (global as any).ErrorUtils.getGlobalHandler();
|
||||
(global as any).ErrorUtils.setGlobalHandler(async (error: any, isFatal: boolean) => {
|
||||
await logger.error(`Unhandled Exception (Fatal: ${isFatal})`, error);
|
||||
defaultErrorHandler(error, isFatal);
|
||||
(global as any).ErrorUtils.setGlobalHandler((error: any, isFatal: boolean) => {
|
||||
logger.error(`Unhandled Exception (Fatal: ${isFatal})`, error)
|
||||
.catch(console.error)
|
||||
.finally(() => {
|
||||
// Delay termination until log is written
|
||||
defaultErrorHandler(error, isFatal);
|
||||
});
|
||||
});
|
||||
import KioskMode from './modules/kiosk-mode';
|
||||
|
||||
@@ -83,7 +87,7 @@ export default function App() {
|
||||
|
||||
const handleReset = () => {
|
||||
setPhotoUris([]);
|
||||
setCurrentScreen('home');
|
||||
setCurrentScreen('home'); // Go to home when cancelled
|
||||
};
|
||||
|
||||
const handleSaveSettings = (updated: AppSettings) => {
|
||||
|
||||
Reference in New Issue
Block a user