2020-01-17 23:37:52 +03:00
|
|
|
export default class RequestAbortedError extends Error {
|
2020-05-24 02:08:24 +03:00
|
|
|
private error: Error | Response;
|
2020-01-17 23:37:52 +03:00
|
|
|
|
2020-05-24 02:08:24 +03:00
|
|
|
constructor(error: Error | Response) {
|
|
|
|
super();
|
2020-01-17 23:37:52 +03:00
|
|
|
|
2020-05-24 02:08:24 +03:00
|
|
|
this.name = this.constructor.name;
|
|
|
|
this.message = this.constructor.name;
|
|
|
|
this.stack = new Error().stack;
|
2018-11-04 10:09:42 +02:00
|
|
|
|
2020-05-24 02:08:24 +03:00
|
|
|
if ('message' in error) {
|
|
|
|
this.message = error.message;
|
|
|
|
}
|
2019-12-07 13:28:52 +02:00
|
|
|
|
2020-05-24 02:08:24 +03:00
|
|
|
this.error = error;
|
|
|
|
Object.assign(this, error);
|
|
|
|
}
|
2018-11-04 10:09:42 +02:00
|
|
|
}
|