fix: add api fetch error reason

Signed-off-by: Innei <i@innei.in>
This commit is contained in:
Innei 2024-07-02 12:22:26 +08:00
parent 77328ef8db
commit 37efb0b9f9
No known key found for this signature in database
GPG Key ID: 0F62D33977F021F7
1 changed files with 2 additions and 1 deletions

View File

@ -51,7 +51,8 @@ export const getFetchErrorMessage = (error: Error) => {
const json = JSON.parse(error.response?._data)
// TODO get the biz code to show the error message, and for i18n
// const bizCode = json.code
return json.message || error.message
const { reason } = json
return `${json.message || error.message}${reason ? `: ${reason}` : ""}`
} catch {
return error.message
}