import axios from 'axios'; import { LoggerUtils } from '../logger'; import { ApiException } from './errors'; export function handleApiException(error) { var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m; // only do something if not canceled, cancellation should be fine if (axios.isCancel(error)) { throw error; } else { throw new ApiException((_b = (_a = error.config) === null || _a === void 0 ? void 0 : _a.url) !== null && _b !== void 0 ? _b : null, (_d = (_c = error.response) === null || _c === void 0 ? void 0 : _c.status) !== null && _d !== void 0 ? _d : null, (_f = (_e = error.config) === null || _e === void 0 ? void 0 : _e.method) !== null && _f !== void 0 ? _f : null, { params: (_h = (_g = error.config) === null || _g === void 0 ? void 0 : _g.params) !== null && _h !== void 0 ? _h : null, data: (_k = (_j = error.config) === null || _j === void 0 ? void 0 : _j.data) !== null && _k !== void 0 ? _k : null, serverErrorData: (_m = (_l = error.response) === null || _l === void 0 ? void 0 : _l.data) !== null && _m !== void 0 ? _m : [], }); } } export function handleApiAdapterException(error) { LoggerUtils.logError(error); throw error; }