fix(ui): use describeApiError across remaining error-surface sites
Extends the previous describeApiError rollout to the rest of the UI.
Two symptom classes covered:
- Bare e.message / err.message in toast descriptions would render
"undefined" on Spring error bodies (plain objects without a proper
Error prototype). Affected: OidcConfigPage (save/test/delete),
ClaimMappingRulesModal (save + test), AgentHealth (dismiss),
RouteControlBar (route action + replay).
- Inline {String(error)} on load-failure banners would render
"[object Object]". Affected: InboxPage, RulesListPage, SilencesPage,
OutboundConnectionsPage.
Not touched: auth-store, AppsTab, UsersTab — they already guard with
`e instanceof Error` and fall back to a static string; replacing the
fallback with describeApiError would be a behavioral change best
evaluated separately.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -4,6 +4,7 @@ import { useToast, ConfirmDialog } from '@cameleer/design-system';
|
||||
import { useSendRouteCommand, useReplayExchange } from '../../api/queries/commands';
|
||||
import type { CommandGroupResponse } from '../../api/queries/commands';
|
||||
import { useEnvironmentStore } from '../../api/environment-store';
|
||||
import { describeApiError } from '../../api/errors';
|
||||
import styles from './RouteControlBar.module.css';
|
||||
|
||||
interface RouteControlBarProps {
|
||||
@@ -68,7 +69,7 @@ export function RouteControlBar({ application, routeId, routeState, hasRouteCont
|
||||
setSendingAction(null);
|
||||
},
|
||||
onError: (err) => {
|
||||
toast({ title: `Route ${action} failed`, description: err.message, variant: 'error', duration: 86_400_000 });
|
||||
toast({ title: `Route ${action} failed`, description: describeApiError(err), variant: 'error', duration: 86_400_000 });
|
||||
setSendingAction(null);
|
||||
},
|
||||
},
|
||||
@@ -92,7 +93,7 @@ export function RouteControlBar({ application, routeId, routeState, hasRouteCont
|
||||
setSendingAction(null);
|
||||
},
|
||||
onError: (err) => {
|
||||
toast({ title: 'Replay failed', description: err.message, variant: 'error', duration: 86_400_000 });
|
||||
toast({ title: 'Replay failed', description: describeApiError(err), variant: 'error', duration: 86_400_000 });
|
||||
setSendingAction(null);
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user