mirror of
https://github.com/langgenius/dify.git
synced 2026-09-06 01:04:49 +08:00
11 lines
486 B
TypeScript
11 lines
486 B
TypeScript
export function responseStatus(error: unknown): number | undefined {
|
|
if (error instanceof Response) return error.status
|
|
if (error && typeof error === 'object' && 'status' in error)
|
|
return typeof error.status === 'number' ? error.status : undefined
|
|
if (error && typeof error === 'object' && 'data' in error) {
|
|
const data = error.data
|
|
if (data && typeof data === 'object' && 'status' in data)
|
|
return typeof data.status === 'number' ? data.status : undefined
|
|
}
|
|
}
|