Skip to content

Commit

Permalink
Automatically throw on 5xx error responses
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaw3d committed Aug 9, 2024
1 parent 7ad0ed8 commit 9fe4a38
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions .changelog/1493.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Automatically throw on 5xx error responses
5 changes: 5 additions & 0 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ const queryClient = new QueryClient({
queries: {
refetchOnWindowFocus: false,
retry: false,
useErrorBoundary: (error: any) => {
// Automatically throw on 5xx errors. Components that want to handle
// errors should set `useErrorBoundary: false` in their queries.
return error.response?.status >= 500
},
},
},
})
Expand Down

0 comments on commit 9fe4a38

Please sign in to comment.