-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Misc changes to error handling and useMergedInfiniteQueries (#757)
UseMergedInfiniteQueries: Return a merged error object utils/request: Add Zod validation errors to RequestError Misc: Add a refetch function to refetch queries which errored out Misc: fix docstrings in useMergedInfiniteQueries and mergeSortedArrays
- Loading branch information
1 parent
71feb5a
commit d0fa4ab
Showing
6 changed files
with
58 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
src/hooks/use-merged-infinite-queries/use-merged-infinite-queries-error.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export class UseMergedInfiniteQueriesError extends Error { | ||
errors: Array<Error>; | ||
constructor(message: string, errors: Array<Error>, options?: ErrorOptions) { | ||
super(message, options); | ||
this.errors = errors; | ||
this.name = 'UseMergedInfiniteQueriesError'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,19 @@ | ||
import { type ZodIssue } from 'zod'; | ||
|
||
export class RequestError extends Error { | ||
status: number; | ||
constructor(message: string, status: number, options?: ErrorOptions) { | ||
validationErrors: Array<ZodIssue> | undefined; | ||
constructor( | ||
message: string, | ||
status: number, | ||
validationErrors?: Array<ZodIssue>, | ||
options?: ErrorOptions | ||
) { | ||
super(message, options); | ||
this.status = status; | ||
if (validationErrors?.length) { | ||
this.validationErrors = validationErrors; | ||
} | ||
this.name = 'RequestError'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters