From 326619069b3bf346caba147fc202f01168be300a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Thu, 15 Oct 2026 23:16:52 +0200 Subject: [PATCH] fix: route the AI usage and lab merge error toasts through the error-id helper --- src/components/admin/ai-usage-section.tsx | 5 ++++- src/components/labs/biomarker-merge-sheet.tsx | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/components/admin/ai-usage-section.tsx b/src/components/admin/ai-usage-section.tsx index b949e5710..e84cd425b 100644 --- a/src/components/admin/ai-usage-section.tsx +++ b/src/components/admin/ai-usage-section.tsx @@ -18,6 +18,8 @@ import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"; import { Gauge } from "lucide-react"; import { toast } from "sonner"; +import { showErrorToast } from "@/lib/errors/error-toast"; + import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; @@ -120,10 +122,11 @@ function AiUsageForm({ bounds }: { bounds: AiUsageBounds }) { toast.success(t("common.saved")); }, onError: (err) => { - toast.error( + showErrorToast( err instanceof Error && err.message ? err.message : t("admin.settingsSaveError"), + { cause: err }, ); }, }); diff --git a/src/components/labs/biomarker-merge-sheet.tsx b/src/components/labs/biomarker-merge-sheet.tsx index 8fd26f9f7..babc4a7f9 100644 --- a/src/components/labs/biomarker-merge-sheet.tsx +++ b/src/components/labs/biomarker-merge-sheet.tsx @@ -13,7 +13,7 @@ */ import { useMemo, useState } from "react"; import { useMutation, useQueryClient } from "@tanstack/react-query"; -import { toast } from "sonner"; +import { showErrorToast } from "@/lib/errors/error-toast"; import { Loader2 } from "lucide-react"; import { toastWrittenOutcome } from "@/components/outcome/outcome-toast"; @@ -83,7 +83,7 @@ export function BiomarkerMergeSheet({ reset(); onOpenChange(false); }, - onError: () => toast.error(t("labs.merge.error")), + onError: (err) => showErrorToast(t("labs.merge.error"), { cause: err }), }); const toggle = (id: string, checked: boolean) => {