Files
automatisch/packages/backend/src/errors/http.ts
2022-11-25 00:49:40 +01:00

18 lines
425 B
TypeScript

import type { AxiosResponse, AxiosError } from 'axios';
import { IJSONObject } from '@automatisch/types';
import BaseError from './base';
export default class HttpError extends BaseError {
response: AxiosResponse;
constructor(error: AxiosError) {
const computedError =
error.response?.data as IJSONObject ||
error.message as string;
super(computedError);
this.response = error.response;
}
}