mirror of
https://github.com/langgenius/dify.git
synced 2026-11-12 06:11:12 +08:00
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: CodingOnStar <hanxujiang@dify.com> Co-authored-by: hjlarry <hjlarry@163.com> Co-authored-by: yyh <92089059+lyzno1@users.noreply.github.com> Co-authored-by: yyh <yuanyouhuilyz@gmail.com>
15 lines
517 B
TypeScript
15 lines
517 B
TypeScript
export function getNetworkAccessErrorStatus(error: unknown): number | undefined {
|
|
if (error instanceof Response) return error.status
|
|
if (typeof error === 'object' && error !== null) {
|
|
if ('status' in error && typeof error.status === 'number') return error.status
|
|
if (
|
|
'response' in error &&
|
|
typeof error.response === 'object' &&
|
|
error.response !== null &&
|
|
'status' in error.response &&
|
|
typeof error.response.status === 'number'
|
|
)
|
|
return error.response.status
|
|
}
|
|
}
|