2018-11-04 13:39:42 +05:30
|
|
|
function RequestAbortedError(error: Error | Response) {
|
2019-11-27 14:33:32 +05:30
|
|
|
this.name = 'RequestAbortedError';
|
|
|
|
this.message = 'RequestAbortedError';
|
|
|
|
this.error = error;
|
|
|
|
this.stack = new Error().stack;
|
2018-11-04 13:39:42 +05:30
|
|
|
|
2019-11-27 14:33:32 +05:30
|
|
|
if (typeof error === 'string') {
|
|
|
|
this.message = error;
|
|
|
|
} else {
|
2019-12-07 16:58:52 +05:30
|
|
|
if ('message' in error) {
|
|
|
|
this.message = error.message;
|
|
|
|
}
|
|
|
|
|
2019-11-27 14:33:32 +05:30
|
|
|
this.error = error;
|
|
|
|
Object.assign(this, error);
|
|
|
|
}
|
2018-11-04 13:39:42 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
RequestAbortedError.prototype = Object.create(Error.prototype);
|
|
|
|
RequestAbortedError.prototype.constructor = RequestAbortedError;
|
|
|
|
|
|
|
|
export default RequestAbortedError;
|