/** * 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 }