accounts-frontend/packages/app/services/request/RequestAbortedError.ts
2020-05-24 02:08:24 +03:00

19 lines
445 B
TypeScript

export default class RequestAbortedError extends Error {
private error: Error | Response;
constructor(error: Error | Response) {
super();
this.name = this.constructor.name;
this.message = this.constructor.name;
this.stack = new Error().stack;
if ('message' in error) {
this.message = error.message;
}
this.error = error;
Object.assign(this, error);
}
}