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])