mirror of
https://github.com/langgenius/dify.git
synced 2026-05-07 02:46:32 +08:00
fix(web): preserve dropdown error messages
This commit is contained in:
parent
871fc0256b
commit
21d2671c34
@ -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])
|
||||
|
||||
Loading…
Reference in New Issue
Block a user