mirror of https://github.com/nocodb/nocodb
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
450 B
15 lines
450 B
2 years ago
|
export async function extractSdkResponseErrorMsg(e: Error & { response: any }) {
|
||
|
if (!e || !e.response) return e.message
|
||
3 years ago
|
let msg
|
||
|
if (e.response.data instanceof Blob) {
|
||
|
try {
|
||
|
msg = JSON.parse(await e.response.data.text()).msg
|
||
2 years ago
|
} catch {
|
||
3 years ago
|
msg = 'Some internal error occurred'
|
||
|
}
|
||
2 years ago
|
} else {
|
||
2 years ago
|
msg = e.response.data.msg || e.response.data.message || 'Some internal error occurred'
|
||
3 years ago
|
}
|
||
|
return msg || 'Some error occurred'
|
||
|
}
|