Skip to content

Commit

Permalink
Better error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
tjcouch-sil committed Nov 13, 2024
1 parent e28a319 commit 2a5a503
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
2 changes: 2 additions & 0 deletions src/declarations/papi-shared-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<StuffDataTypes>;
'platform.placeholder': IDataProvider<PlaceholderDataTypes>;
}
Expand Down Expand Up @@ -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<boolean> }>;
'platform.placeholderWebView': NetworkableObject<{
runPlaceholderStuff(thing: string): Promise<boolean>;
Expand Down
10 changes: 7 additions & 3 deletions src/extension-host/services/extension.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
}
})();
}

Expand Down
1 change: 0 additions & 1 deletion src/main/services/extension-host.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
4 changes: 2 additions & 2 deletions src/shared/services/web-view-provider.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,8 @@ async function registerWebViewController<WebViewType extends WebViewControllerTy
});

if (webViewControllersById.has(webViewId))
logger.warn(
`Web view provider service is setting web view controller with id ${webViewId} (type ${webViewType}) in the map over an existing web view. This is not expected.`,
throw new Error(
`Web view provider service tried to set web view controller with id ${webViewId} (type ${webViewType}) in the map over an existing web view.`,
);
webViewControllersById.set(webViewId, disposableWebViewController);

Expand Down

0 comments on commit 2a5a503

Please sign in to comment.