fix: better api call error msgs in some cases
This commit is contained in:
parent
f5c5eff3ac
commit
4d1d499c93
1 changed files with 9 additions and 1 deletions
|
|
@ -616,6 +616,14 @@ export namespace MessageV2 {
|
|||
case APICallError.isInstance(e):
|
||||
const message = iife(() => {
|
||||
let msg = e.message
|
||||
if (msg === "") {
|
||||
if (e.responseBody) return e.responseBody
|
||||
if (e.statusCode) {
|
||||
const err = STATUS_CODES[e.statusCode]
|
||||
if (err) return err
|
||||
}
|
||||
return "Unknown error"
|
||||
}
|
||||
const transformed = ProviderTransform.error(ctx.providerID, e)
|
||||
if (transformed !== msg) {
|
||||
return transformed
|
||||
|
|
@ -634,7 +642,7 @@ export namespace MessageV2 {
|
|||
} catch {}
|
||||
|
||||
return `${msg}: ${e.responseBody}`
|
||||
})
|
||||
}).trim()
|
||||
|
||||
return new MessageV2.APIError(
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue