mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-27 21:01:32 +08:00
fix(ErrorBlock): 修复错误状态码检查逻辑以支持statusCode字段
This commit is contained in:
parent
3114623a33
commit
dd1d5740d8
@ -89,7 +89,10 @@ const MessageErrorInfo: React.FC<{ block: ErrorMessageBlock; message: Message }>
|
||||
}
|
||||
|
||||
const getAlertMessage = () => {
|
||||
const status = block.error && 'status' in block.error ? block.error?.status : undefined
|
||||
const status =
|
||||
block.error && ('status' in block.error || 'statusCode' in block.error)
|
||||
? block.error?.status || block.error?.statusCode
|
||||
: undefined
|
||||
if (block.error && typeof status === 'number' && HTTP_ERROR_CODES.includes(status)) {
|
||||
return block.error.message
|
||||
}
|
||||
@ -97,7 +100,10 @@ const MessageErrorInfo: React.FC<{ block: ErrorMessageBlock; message: Message }>
|
||||
}
|
||||
|
||||
const getAlertDescription = () => {
|
||||
const status = block.error && 'status' in block.error ? block.error?.status : undefined
|
||||
const status =
|
||||
block.error && ('status' in block.error || 'statusCode' in block.error)
|
||||
? block.error?.status || block.error?.statusCode
|
||||
: undefined
|
||||
if (block.error && typeof status === 'number' && HTTP_ERROR_CODES.includes(status)) {
|
||||
return getHttpMessageLabel(status.toString())
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user