feat: Enrich error responses
This commit is contained in:
12
packages/backend/src/errors/http.ts
Normal file
12
packages/backend/src/errors/http.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { IJSONObject } from '@automatisch/types';
|
||||
import BaseError from './base';
|
||||
|
||||
export default class HttpError extends BaseError {
|
||||
constructor(error: IJSONObject) {
|
||||
const computedError =
|
||||
((error.response as IJSONObject)?.data as IJSONObject) ||
|
||||
(error.message as string);
|
||||
|
||||
super(computedError);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user