FEAT-3: fix unhandled ApiError rejections (catch in form submits + dev unhandledrejection guard, ApiError carries path)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-06 00:36:14 +02:00
parent e76554342b
commit c6699a9592
5 changed files with 48 additions and 7 deletions

View File

@@ -166,8 +166,13 @@ export default function GerbilFormPage() {
genotype: nn(form.genotype),
notes: nn(form.notes),
}
const saved = await mutation.run(body)
navigate(`/rennmaeuse/${saved.id}`)
try {
const saved = await mutation.run(body)
navigate(`/rennmaeuse/${saved.id}`)
} catch {
// Error is surfaced via mutation.error; swallow so the rejected promise
// from this async submit handler doesn't become an unhandled rejection.
}
}
if (isEdit && existing.loading) return <p className="muted">{de.common.loading}</p>