rudeshark.net/packages/megalodon/src/cancel.ts

14 lines
290 B
TypeScript
Raw Normal View History

export class RequestCanceledError extends Error {
2023-07-17 00:32:32 +02:00
public isCancel: boolean;
2023-07-17 00:32:32 +02:00
constructor(msg: string) {
super(msg);
this.isCancel = true;
Object.setPrototypeOf(this, RequestCanceledError);
}
}
export const isCancel = (value: any): boolean => {
2023-07-17 00:32:32 +02:00
return value && value.isCancel;
};