fix(app): handle captcha URL load failures

Add error handling to the captcha URL loading process to prevent
unhandled promise rejections. If the URL fails to load, the captcha
answer is cleared and the window is closed if it hasn't been destroyed.
This commit is contained in:
Snipzil committed 2026-10-21 20:34:59 -04:00
1 parent ab8bfd5a9d
commit 3cb8764603
1 file changed
+6 -1
+6 -1
View File
@@ -353,7 +353,12 @@ ipcMain.handle("captcha", (event, serverUrl, action) => new Promise(resolve => {
captchaServer = null;
answer("");
});
box.loadURL(new URL(`/captcha?action=${action === "signup" ? "signup" : "login"}`, server).href);
box.loadURL(new URL(`/captcha?action=${action === "signup" ? "signup" : "login"}`, server).href).catch(() => {
answer("");
if (!box.isDestroyed()) {
box.close();
}
});
}));
// what the client's processes use: the game is the "Pepper Plugin" one.