多维表格
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

15 lines
423 B

export async function extractSdkResponseErrorMsg(e:Error & {response:any}) {
if (!e || !e.response) { return e.message }
let msg
if (e.response.data instanceof Blob) {
try {
msg = JSON.parse(await e.response.data.text()).msg
} catch {
msg = 'Some internal error occurred'
}
} else {
msg = e.response.data.msg || 'Some internal error occurred'
}
return msg || 'Some error occurred'
}