fix(alerts): add AGENT_LIFECYCLE to condition_kind_enum + readable error toasts
Backend - V18 migration adds AGENT_LIFECYCLE to condition_kind_enum. Java ConditionKind enum shipped with this value but no Postgres migration extended the type, so any AGENT_LIFECYCLE rule insert failed with "invalid input value for enum condition_kind_enum". - ALTER TYPE ... ADD VALUE lives alone in its migration per Postgres constraint that the new value cannot be referenced in the same tx. - V18MigrationIT asserts the enum now contains all 7 kinds. Frontend - Add describeApiError(e) helper to unwrap openapi-fetch error bodies (Spring error JSON) into readable strings. String(e) on a plain object rendered "[object Object]" in toasts — the actual failure reason was hidden from the user. - Replace String(e) in all 13 toast descriptions across the alerting and outbound-connection mutation paths. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -16,6 +16,7 @@ import {
|
||||
type TrustMode,
|
||||
} from '../../api/queries/admin/outboundConnections';
|
||||
import { useEnvironments } from '../../api/queries/admin/environments';
|
||||
import { describeApiError } from '../../api/errors';
|
||||
import sectionStyles from '../../styles/section-card.module.css';
|
||||
|
||||
// ── Form state ──────────────────────────────────────────────────────────
|
||||
@@ -145,12 +146,12 @@ export default function OutboundConnectionEditor() {
|
||||
toast({ title: 'Created', description: form.name, variant: 'success' });
|
||||
navigate('/admin/outbound-connections');
|
||||
},
|
||||
onError: (e) => toast({ title: 'Create failed', description: String(e), variant: 'error' }),
|
||||
onError: (e) => toast({ title: 'Create failed', description: describeApiError(e), variant: 'error' }),
|
||||
});
|
||||
} else {
|
||||
updateMut.mutate(payload, {
|
||||
onSuccess: () => toast({ title: 'Updated', description: form.name, variant: 'success' }),
|
||||
onError: (e) => toast({ title: 'Update failed', description: String(e), variant: 'error' }),
|
||||
onError: (e) => toast({ title: 'Update failed', description: describeApiError(e), variant: 'error' }),
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -7,6 +7,7 @@ import {
|
||||
type OutboundConnectionDto,
|
||||
type TrustMode,
|
||||
} from '../../api/queries/admin/outboundConnections';
|
||||
import { describeApiError } from '../../api/errors';
|
||||
import sectionStyles from '../../styles/section-card.module.css';
|
||||
|
||||
export default function OutboundConnectionsPage() {
|
||||
@@ -23,7 +24,7 @@ export default function OutboundConnectionsPage() {
|
||||
if (!confirm(`Delete outbound connection "${c.name}"?`)) return;
|
||||
deleteMut.mutate(c.id, {
|
||||
onSuccess: () => toast({ title: 'Deleted', description: c.name, variant: 'success' }),
|
||||
onError: (e) => toast({ title: 'Delete failed', description: String(e), variant: 'error' }),
|
||||
onError: (e) => toast({ title: 'Delete failed', description: describeApiError(e), variant: 'error' }),
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user