mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-06-18 04:50:05 -04:00
19 lines
416 B
JavaScript
19 lines
416 B
JavaScript
import {
|
|
ExtendedError,
|
|
ERROR_HTTP_NETWORK_ERROR,
|
|
ERROR_HTTP_UNEXPECTED_RESPONSE_STATUS
|
|
} from '../errors';
|
|
|
|
export function handleAxiosError(error) {
|
|
if (error.request) {
|
|
// Axios errors.
|
|
if (error.response) {
|
|
error = new ExtendedError(ERROR_HTTP_UNEXPECTED_RESPONSE_STATUS, error.response);
|
|
} else {
|
|
error = new ExtendedError(ERROR_HTTP_NETWORK_ERROR);
|
|
}
|
|
}
|
|
|
|
return error;
|
|
}
|