diff --git a/frontend/src/context/AuthContext.tsx b/frontend/src/context/AuthContext.tsx index 2604c718..e09a0227 100644 --- a/frontend/src/context/AuthContext.tsx +++ b/frontend/src/context/AuthContext.tsx @@ -136,7 +136,9 @@ export const AuthProvider: FC<{ children: ReactNode }> = ({ children }) => { : typeof error === 'object' && error !== null && 'response' in error ? (error as { response?: { data?: { error?: string } } }).response?.data?.error || 'Password change failed' : 'Password change failed'; - throw new Error(message); + throw new Error(message, { + cause: error, + }); } }; diff --git a/frontend/src/hooks/useDocker.ts b/frontend/src/hooks/useDocker.ts index 24e11e0e..06a9a006 100644 --- a/frontend/src/hooks/useDocker.ts +++ b/frontend/src/hooks/useDocker.ts @@ -18,7 +18,9 @@ export function useDocker(host?: string | null, serverId?: string | null) { if (error.response?.status === 503) { const details = error.response?.data?.details const message = details || 'Docker service unavailable. Check that Docker is running.' - throw new Error(message) + throw new Error(message, { + cause: err, + }) } throw err } diff --git a/frontend/src/pages/AuditLogs.tsx b/frontend/src/pages/AuditLogs.tsx index abc94753..255737cf 100644 --- a/frontend/src/pages/AuditLogs.tsx +++ b/frontend/src/pages/AuditLogs.tsx @@ -42,12 +42,13 @@ function AuditLogDetailModal({ }) { if (!log) return null - let parsedDetails: Record = {} - try { - parsedDetails = JSON.parse(log.details) - } catch { - parsedDetails = { raw: log.details } - } + const parsedDetails: Record = (() => { + try { + return JSON.parse(log.details) + } catch { + return { raw: log.details } + } + })() return (