From 21d2671c340cb3049419e6eef7bfff32f8a50f85 Mon Sep 17 00:00:00 2001 From: yyh Date: Thu, 30 Apr 2026 13:48:17 +0800 Subject: [PATCH] fix(web): preserve dropdown error messages --- web/app/components/app-sidebar/dataset-info/dropdown.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/web/app/components/app-sidebar/dataset-info/dropdown.tsx b/web/app/components/app-sidebar/dataset-info/dropdown.tsx index a8a7c51ae8..3676547cdf 100644 --- a/web/app/components/app-sidebar/dataset-info/dropdown.tsx +++ b/web/app/components/app-sidebar/dataset-info/dropdown.tsx @@ -91,10 +91,16 @@ const DropDown = ({ } catch (e: unknown) { let message = 'Unknown error' + const errorWithJson = typeof e === 'object' && e !== null ? e as { json?: unknown } : null if (e instanceof Response) { const res = await e.json() as { message?: string } message = res?.message || message } + else if (typeof errorWithJson?.json === 'function') { + const parseErrorResponse = errorWithJson.json as () => Promise<{ message?: string }> + const res = await parseErrorResponse() + message = res?.message || message + } toast(message, { type: 'error' }) } }, [dataset.id, t])