mirror of
https://github.com/elyby/accounts-frontend.git
synced 2024-12-14 09:19:03 +05:30
24 lines
596 B
JavaScript
24 lines
596 B
JavaScript
|
// @flow
|
||
|
function RequestAbortedError(error: Error | Response) {
|
||
|
this.name = 'RequestAbortedError';
|
||
|
this.message = 'RequestAbortedError';
|
||
|
this.error = error;
|
||
|
this.stack = new Error().stack;
|
||
|
|
||
|
if (error.message) {
|
||
|
this.message = error.message;
|
||
|
}
|
||
|
|
||
|
if (typeof error === 'string') {
|
||
|
this.message = error;
|
||
|
} else {
|
||
|
this.error = error;
|
||
|
Object.assign(this, error);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
RequestAbortedError.prototype = Object.create(Error.prototype);
|
||
|
RequestAbortedError.prototype.constructor = RequestAbortedError;
|
||
|
|
||
|
export default RequestAbortedError;
|