UNPKG

433 BJavaScriptView Raw
1import { RequestError } from '../core/errors.js';
2/**
3An error to be thrown when the request is aborted with `.cancel()`.
4*/
5export class CancelError extends RequestError {
6 constructor(request) {
7 super('Promise was canceled', {}, request);
8 this.name = 'CancelError';
9 this.code = 'ERR_CANCELED';
10 }
11 /**
12 Whether the promise is canceled.
13 */
14 get isCanceled() {
15 return true;
16 }
17}