From 7f93a17526d8b0d5bb69e154ded1a3091ddaf331 Mon Sep 17 00:00:00 2001 From: tone Date: Thu, 18 Dec 2025 21:45:37 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=89=8D=E7=AB=AF=E6=B7=BB=E5=8A=A0Gen?= =?UTF-8?q?eralErrorHandler?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/frontend/lib/api/common.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/apps/frontend/lib/api/common.ts b/apps/frontend/lib/api/common.ts index 4c052df..bd1e885 100644 --- a/apps/frontend/lib/api/common.ts +++ b/apps/frontend/lib/api/common.ts @@ -1,3 +1,5 @@ +import { toast } from "sonner"; + export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH'; export interface APIResponse { @@ -64,4 +66,8 @@ export function handleAPIError(error: unknown, handler: (e: APIError) => void): throw error; } +} + +export function GeneralErrorHandler(e: APIError) { + toast.error(`${e.message}`) } \ No newline at end of file