2020-01-18 02:07:52 +05:30
|
|
|
export default class RequestAbortedError extends Error {
|
2020-05-24 04:38:24 +05:30
|
|
|
private error: Error | Response;
|
2020-01-18 02:07:52 +05:30
|
|
|
|
2020-05-24 04:38:24 +05:30
|
|
|
constructor(error: Error | Response) {
|
|
|
|
super();
|
2020-01-18 02:07:52 +05:30
|
|
|
|
2020-05-24 04:38:24 +05:30
|
|
|
this.name = this.constructor.name;
|
|
|
|
this.message = this.constructor.name;
|
|
|
|
this.stack = new Error().stack;
|
2018-11-04 13:39:42 +05:30
|
|
|
|
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);
|
|
|
|
}
|
2018-11-04 13:39:42 +05:30
|
|
|
}
|