fix(ui): use describeApiError across remaining error-surface sites
Some checks failed
CI / cleanup-branch (push) Has been skipped
CI / build (push) Successful in 2m3s
CI / docker (push) Successful in 1m15s
CI / deploy-feature (push) Has been skipped
CI / deploy (push) Failing after 29s

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:
hsiegeln
2026-04-21 20:37:16 +02:00
parent b7d201d743
commit 74bfabf618
8 changed files with 20 additions and 16 deletions

View File

@@ -23,6 +23,7 @@ import type { ConfigUpdateResponse } from '../../api/queries/commands';
import type { AgentInstance } from '../../api/types';
import { timeAgo } from '../../utils/format-utils';
import { formatUptime, mapLogLevel, eventSeverity, eventIcon } from '../../utils/agent-utils';
import { describeApiError } from '../../api/errors';
// ── Helpers ──────────────────────────────────────────────────────────────────
@@ -506,7 +507,7 @@ export default function AgentHealth() {
navigate('/runtime');
},
onError: (err) => {
toast({ title: 'Dismiss failed', description: err.message, variant: 'error', duration: 86_400_000 });
toast({ title: 'Dismiss failed', description: describeApiError(err), variant: 'error', duration: 86_400_000 });
},
});
}}