From 2a5a503ec7b55daa7b0acbdebe6534c2fb3c8248 Mon Sep 17 00:00:00 2001 From: tjcouch-sil Date: Wed, 13 Nov 2024 17:25:01 -0600 Subject: [PATCH] Better error handling --- src/declarations/papi-shared-types.ts | 2 ++ src/extension-host/services/extension.service.ts | 10 +++++++--- src/main/services/extension-host.service.ts | 1 - src/shared/services/web-view-provider.service.ts | 4 ++-- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/declarations/papi-shared-types.ts b/src/declarations/papi-shared-types.ts index cf91ee2df5..7bb796a20b 100644 --- a/src/declarations/papi-shared-types.ts +++ b/src/declarations/papi-shared-types.ts @@ -489,6 +489,7 @@ declare module 'papi-shared-types' { * ``` */ export interface DataProviders { + // These are examples. Feel free to take them out if we actually need to provide real ones in core 'platform.stuff': IDataProvider; 'platform.placeholder': IDataProvider; } @@ -574,6 +575,7 @@ declare module 'papi-shared-types' { * ``` */ export interface WebViewControllers { + // These are examples. Feel free to take them out if we actually need to provide real ones in core 'platform.stuffWebView': NetworkableObject<{ doStuff(thing: string): Promise }>; 'platform.placeholderWebView': NetworkableObject<{ runPlaceholderStuff(thing: string): Promise; diff --git a/src/extension-host/services/extension.service.ts b/src/extension-host/services/extension.service.ts index a7e24a0043..ba61013963 100644 --- a/src/extension-host/services/extension.service.ts +++ b/src/extension-host/services/extension.service.ts @@ -1206,9 +1206,13 @@ async function reloadExtensions( isReloading = false; if (shouldReload) { (async () => { - await platformBibleUtils.wait(RESTART_DELAY_MS); - shouldReload = false; - reloadExtensions(shouldDeactivateExtensions, shouldEmitDidReloadEvent); + try { + await platformBibleUtils.wait(RESTART_DELAY_MS); + shouldReload = false; + await reloadExtensions(shouldDeactivateExtensions, shouldEmitDidReloadEvent); + } catch (e) { + logger.error(`Subsequent reload after initial reload extensions failed! ${e}`); + } })(); } diff --git a/src/main/services/extension-host.service.ts b/src/main/services/extension-host.service.ts index 802b984db7..0b64e4f6fd 100644 --- a/src/main/services/extension-host.service.ts +++ b/src/main/services/extension-host.service.ts @@ -88,7 +88,6 @@ async function restartExtensionHost(maxWaitTimeInMS: number) { } // Tells nodemon to restart the process https://github.com/remy/nodemon/blob/HEAD/doc/events.md#using-nodemon-as-child-process extensionHost?.send('restart'); - return undefined; } function hardKillExtensionHost() { diff --git a/src/shared/services/web-view-provider.service.ts b/src/shared/services/web-view-provider.service.ts index c2cef90c04..cdcd486fb1 100644 --- a/src/shared/services/web-view-provider.service.ts +++ b/src/shared/services/web-view-provider.service.ts @@ -239,8 +239,8 @@ async function registerWebViewController