diff --git a/src/renderer/index.tsx b/src/renderer/index.tsx index bdc87c1045..2d9c864f1e 100644 --- a/src/renderer/index.tsx +++ b/src/renderer/index.tsx @@ -10,6 +10,11 @@ import App from './app.component'; import { cleanupOldWebViewState } from './services/web-view-state.service'; import { blockWebSocketsToPapiNetwork } from './services/renderer-web-socket.service'; +window.addEventListener('error', (errorEvent: ErrorEvent) => { + const { filename, lineno, colno, error } = errorEvent; + logger.error(`Unhandled error in renderer from ${filename}:${lineno}:${colno}, '${error}'`); +}); + logger.info('Starting renderer'); // This is a little different than Promise.all in that the error message will have all the reasons diff --git a/src/shared/services/logger.service.ts b/src/shared/services/logger.service.ts index ea7b78c89e..1db42be1f1 100644 --- a/src/shared/services/logger.service.ts +++ b/src/shared/services/logger.service.ts @@ -124,7 +124,7 @@ if (isClient()) { ), }; }); - if (isExtensionHost()) + else if (isExtensionHost()) // Add a tag for warnings so we can recognize them outside the process. log.hooks.push((message) => { const caller = identifyCaller(); @@ -136,6 +136,10 @@ if (isClient()) { ), }; }); + else { + // eslint-disable-next-line no-console + console.warn(chalk.yellow(`Unexpected process type: ${globalThis.processType}`)); + } } else { log.initialize(); log.transports.console.level = globalThis.logLevel;