egirlskey/packages/megalodon/src/cancel.ts
2023-09-25 01:49:57 +02:00

13 lines
294 B
TypeScript

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
}