fix(settings): performSwitch 补 catch — 本地 ASR 切换失败不再裸抛

LocalModelSection.performSwitch 是 async、try/finally 无 catch,而调用方
(Qwen3 / Foundry / sherpa Toggle、禁用按钮)都是 void performSwitch(...)
即发即忘。setActiveAsrProvider / updatePrefs 失败会冒成未处理的 promise
rejection。补 catch + console.error 吞掉。
This commit is contained in:
baiqing committed 2026-05-22 22:28:53 +08:00
1 parent 74be27d3e2
commit 8986c5680b
1 file changed
+4
@@ -43,6 +43,10 @@ export function LocalModelSection() {
if (prefs) {
await updatePrefs({ ...prefs, activeAsrProvider: target });
}
} catch (err) {
// 调用方是 void performSwitch(...) 即发即忘 —— 这里吞掉并记日志,否则 IPC
// 失败会冒成未处理的 promise rejection。
console.error('[settings] switch local ASR provider failed', err);
} finally {
if (seq === switchSeqRef.current) {
setBusy(false);