Skip to content

Commit

Permalink
Type safe error name checks
Browse files Browse the repository at this point in the history
  • Loading branch information
nflaig committed Aug 12, 2023
1 parent 902cce0 commit ad57f7c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/api/src/utils/client/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,9 @@ function isNativeFetchInputError(e: unknown): e is NativeFetchInputError {
}

function isNativeFetchAbortError(e: unknown): e is NativeFetchAbortError {
return e instanceof DOMException && e.name === "AbortError";
return e instanceof DOMException && (e as NativeFetchAbortError).name === "AbortError";
}

function isNativeFetchTimeoutError(e: unknown): e is NativeFetchTimeoutError {
return e instanceof DOMException && e.name === "TimeoutError";
return e instanceof DOMException && (e as NativeFetchTimeoutError).name === "TimeoutError";
}

0 comments on commit ad57f7c

Please sign in to comment.