summaryrefslogtreecommitdiff
path: root/packages/megalodon/src/cancel.ts
blob: 3b905a492e5bf8fd06f793ecffa3e0332ee7bb57 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
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
}