accounts-frontend/packages/app/services/request/RequestAbortedError.ts

19 lines
445 B
TypeScript
Raw Normal View History

export default class RequestAbortedError extends Error {
2020-05-24 04:38:24 +05:30
private error: Error | Response;
2020-05-24 04:38:24 +05:30
constructor(error: Error | Response) {
super();
2020-05-24 04:38:24 +05:30
this.name = this.constructor.name;
this.message = this.constructor.name;
this.stack = new Error().stack;
2020-05-24 04:38:24 +05:30
if ('message' in error) {
this.message = error.message;
}
2019-12-07 16:58:52 +05:30
2020-05-24 04:38:24 +05:30
this.error = error;
Object.assign(this, error);
}
}