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
This commit is contained in:
2026-09-22 21:54:49 -07:00
parent d100789232
commit d31a28c54f
+7
View File
@@ -6620,10 +6620,17 @@ const configuredExternalYomitanProfilePath = yomitanProfilePolicy.externalProfil
const yomitanExtensionRuntime = createYomitanExtensionRuntime({
loadYomitanExtensionCore: async (deps) => {
if (activeDictionaryBackend === 'yomitan') return loadYomitanExtensionCore(deps);
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,