feat: Enrich error responses

This commit is contained in:
Faruk AYDIN
2022-11-07 22:51:30 +01:00
parent ad46b3eea3
commit 06a2014bc1
13 changed files with 97 additions and 101 deletions

View File

@@ -2,7 +2,7 @@ import axios, { AxiosRequestConfig } from 'axios';
export { AxiosInstance as IHttpClient } from 'axios';
import { IHttpClientParams } from '@automatisch/types';
import { URL } from 'url';
import HttpError from '../../errors/http-error';
import HttpError from '../../errors/http';
const removeBaseUrlForAbsoluteUrls = (
requestConfig: AxiosRequestConfig
@@ -40,7 +40,7 @@ export default function createHttpClient({
instance.interceptors.response.use(
(response) => response,
(error) => {
throw new HttpError(error.response.data);
throw new HttpError(error);
}
);