From 5942c9ff51bd7d19af26c62e96c311ee84c61cfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BE=9D=E7=91=AA=E8=B2=93?= Date: Tue, 10 Mar 2026 01:00:32 +0800 Subject: [PATCH] Handle caught exceptions properly in catch blocks (S2486) Co-Authored-By: Claude Opus 4.6 --- src/stores/acctMgmt.ts | 2 +- src/stores/login.ts | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/stores/acctMgmt.ts b/src/stores/acctMgmt.ts index b3bef02..bb62d06 100644 --- a/src/stores/acctMgmt.ts +++ b/src/stores/acctMgmt.ts @@ -269,7 +269,7 @@ export const useAcctMgmtStore = defineStore('acctMgmtStore', { this.currentViewingUser = response.data; this.currentViewingUser.is_admin = response.data.roles?.some(role => role.code === 'admin') ?? false; return response.status === 200; - } catch (error) { + } catch { // No need to show an error, because an error here means the account is unique return false; } diff --git a/src/stores/login.ts b/src/stores/login.ts index 3e7da47..b3fba90 100644 --- a/src/stores/login.ts +++ b/src/stores/login.ts @@ -87,6 +87,7 @@ export const useLoginStore = defineStore("loginStore", { } this.$router.push("/files"); } catch (error) { + console.error("Login failed:", error); this.isInvalid = true; } }, @@ -132,6 +133,7 @@ export const useLoginStore = defineStore("loginStore", { try { await apiClient.get(api); } catch (error) { + console.error("Session check failed:", error); this.$router.push("/login"); } },