monkeeShark/packages/megalodon/src/cancel.ts

14 lines
290 B
TypeScript
Raw Normal View History

2023-09-23 16:49:47 +00:00
export class RequestCanceledError extends Error {
public isCancel: boolean;
constructor(msg: string) {
super(msg);
this.isCancel = true;
Object.setPrototypeOf(this, RequestCanceledError);
}
}
export const isCancel = (value: any): boolean => {
return value && value.isCancel;
};