From d31a28c54fcb3300fb110c1430db94377913556f Mon Sep 17 00:00:00 2001 From: sudacode Date: Tue, 22 Sep 2026 21:54:49 -0700 Subject: [PATCH] fix(dictionary): handle Hachidori extension load failures gracefully - Catch errors from the Hachidori extension runtime and log them - Clear the extension and session state and return null instead of rejecting --- src/main.ts | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/main.ts b/src/main.ts index eeb9201c..2edd3248 100644 --- a/src/main.ts +++ b/src/main.ts @@ -6620,10 +6620,17 @@ const configuredExternalYomitanProfilePath = yomitanProfilePolicy.externalProfil const yomitanExtensionRuntime = createYomitanExtensionRuntime({ loadYomitanExtensionCore: async (deps) => { if (activeDictionaryBackend === 'yomitan') return loadYomitanExtensionCore(deps); - const extension = await hachidoriExtensionRuntime.ensureLoaded(); - deps.setYomitanExtension(extension); - deps.setYomitanSession(getHachidoriSession()); - return extension; + try { + const extension = await hachidoriExtensionRuntime.ensureLoaded(); + deps.setYomitanExtension(extension); + deps.setYomitanSession(getHachidoriSession()); + return extension; + } catch (error) { + logger.error('Failed to load Hachidori extension:', error); + deps.setYomitanExtension(null); + deps.setYomitanSession(null); + return null; + } }, userDataPath: USER_DATA_PATH, externalProfilePath: configuredExternalYomitanProfilePath,