refactor: remove useless try/catch wrappers

移除了 3 个无用的 try/catch 包装器:
- users.ts: 移除只重新抛出错误的外层 try/catch
- FileManager.tsx: 移除只重新抛出错误的内层 try/catch
- DiffViewer.tsx: 移除只重新抛出错误的内层 try/catch

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
ZacharyZcR
2025-10-05 21:37:34 +08:00
parent 57a99ae31b
commit f3fde836bc
3 changed files with 106 additions and 118 deletions

View File

@@ -28,7 +28,6 @@ async function verifyOIDCToken(
issuerUrl: string, issuerUrl: string,
clientId: string, clientId: string,
): Promise<any> { ): Promise<any> {
try {
const normalizedIssuerUrl = issuerUrl.endsWith("/") const normalizedIssuerUrl = issuerUrl.endsWith("/")
? issuerUrl.slice(0, -1) ? issuerUrl.slice(0, -1)
: issuerUrl; : issuerUrl;
@@ -112,9 +111,6 @@ async function verifyOIDCToken(
}); });
return payload; return payload;
} catch (error) {
throw error;
}
} }
const router = express.Router(); const router = express.Router();

View File

@@ -710,7 +710,6 @@ function FileManagerContent({ initialHost, onClose }: FileManagerProps) {
try { try {
const currentSessionId = sshSessionId; const currentSessionId = sshSessionId;
try {
const status = await getSSHStatus(currentSessionId); const status = await getSSHStatus(currentSessionId);
if (!status.connected) { if (!status.connected) {
const result = await connectSSH(currentSessionId, { const result = await connectSSH(currentSessionId, {
@@ -729,9 +728,6 @@ function FileManagerContent({ initialHost, onClose }: FileManagerProps) {
throw new Error(t("fileManager.failedToReconnectSSH")); throw new Error(t("fileManager.failedToReconnectSSH"));
} }
} }
} catch (sessionErr) {
throw sessionErr;
}
const symlinkInfo = await identifySSHSymlink(currentSessionId, file.path); const symlinkInfo = await identifySSHSymlink(currentSessionId, file.path);

View File

@@ -62,7 +62,6 @@ export function DiffViewer({
}); });
} }
} catch (error) { } catch (error) {
try {
await connectSSH(sshSessionId, { await connectSSH(sshSessionId, {
hostId: sshHost.id, hostId: sshHost.id,
ip: sshHost.ip, ip: sshHost.ip,
@@ -75,9 +74,6 @@ export function DiffViewer({
credentialId: sshHost.credentialId, credentialId: sshHost.credentialId,
userId: sshHost.userId, userId: sshHost.userId,
}); });
} catch (reconnectError) {
throw reconnectError;
}
} }
}; };