Skip to content

Commit

Permalink
feat: add isFetchError type guard (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
umar-ahmed authored Oct 27, 2021
1 parent 7bb5e01 commit 111a48f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/errors.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { FetchError } from './lib/fetch-error';

export function isFetchError(error: any): error is FetchError {
return error instanceof FetchError;
}

export { FetchError };
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// NOTE: do NOT export `Form` here. Next.js can't properly tree shake the client
// bundle if there are client & server imports in a single import statement.
export * from './errors';
export * from './handle';
export * from './responses';

0 comments on commit 111a48f

Please sign in to comment.