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.
13 lines
409 B
13 lines
409 B
/** |
|
* Given an exception return the list of errors, the singular error, or generic error |
|
* @param {object|string} exception - axios returned exception |
|
*/ |
|
export function parseError(exception) { |
|
let response = exception.response || {}; |
|
let data = response.data || {}; |
|
let err = "" + exception; |
|
if (response.status) { |
|
err = `${response.status} ${response.statusText}`; |
|
} |
|
return data || err |
|
}
|
|
|