Handle caught exceptions properly in catch blocks (S2486)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-10 01:00:32 +08:00
parent 804d78837b
commit 5942c9ff51
2 changed files with 3 additions and 1 deletions

View File

@@ -269,7 +269,7 @@ export const useAcctMgmtStore = defineStore('acctMgmtStore', {
this.currentViewingUser = response.data; this.currentViewingUser = response.data;
this.currentViewingUser.is_admin = response.data.roles?.some(role => role.code === 'admin') ?? false; this.currentViewingUser.is_admin = response.data.roles?.some(role => role.code === 'admin') ?? false;
return response.status === 200; return response.status === 200;
} catch (error) { } catch {
// No need to show an error, because an error here means the account is unique // No need to show an error, because an error here means the account is unique
return false; return false;
} }

View File

@@ -87,6 +87,7 @@ export const useLoginStore = defineStore("loginStore", {
} }
this.$router.push("/files"); this.$router.push("/files");
} catch (error) { } catch (error) {
console.error("Login failed:", error);
this.isInvalid = true; this.isInvalid = true;
} }
}, },
@@ -132,6 +133,7 @@ export const useLoginStore = defineStore("loginStore", {
try { try {
await apiClient.get(api); await apiClient.get(api);
} catch (error) { } catch (error) {
console.error("Session check failed:", error);
this.$router.push("/login"); this.$router.push("/login");
} }
}, },