mirror of
https://hubproxy.babadafafafafa.cn/https://github.com/mihomo-party-org/clash-party.git
synced 2026-09-20 08:03:39 +08:00
fix: do not let a failed window creation surface as an uncaught exception (#2021)
`createWindow()` throws once its retries are exhausted. The call site in `showMainWindow()` only attached a `then`, so that rejection became an unhandled promise rejection and the user got a raw main-process error dialog instead of a log line. Attach a `catch` and log it.
This commit is contained in:
@@ -399,11 +399,14 @@ export function showMainWindow(): void {
|
||||
return
|
||||
}
|
||||
|
||||
void createWindow().then(() => {
|
||||
clearQuitTimeout()
|
||||
mainWindow?.show()
|
||||
mainWindow?.focusOnWebView()
|
||||
})
|
||||
// createWindow 重试耗尽后会 throw,缺 catch 会变成主进程未捕获异常弹窗。
|
||||
void createWindow()
|
||||
.then(() => {
|
||||
clearQuitTimeout()
|
||||
mainWindow?.show()
|
||||
mainWindow?.focusOnWebView()
|
||||
})
|
||||
.catch((error) => mainWindowLogger.error('Failed to show main window', error))
|
||||
}
|
||||
|
||||
export function closeMainWindow(): void {
|
||||
|
||||
Reference in New Issue
Block a user