Skip to content

Commit

Permalink
chore: move error reporting to global handlers
Browse files Browse the repository at this point in the history
Reference-to: #47, #49
Signed-off-by: Prince Muel <[email protected]>
  • Loading branch information
princemuel committed Jun 7, 2023
1 parent c38b6b7 commit f78a2bb
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/providers/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ const Providers = (props: Props) => {
// },
onError: (error, query) => {
if (query.state.data !== undefined) {
toast.error(`Something went wrong: ${getErrorMessage(error)}`);
//@ts-expect-error ignore expected error
toast.error(getErrorMessage(error?.response?.errors?.[0]));
}
},
}),
Expand All @@ -60,7 +61,8 @@ const Providers = (props: Props) => {
// },
onError: (error, variables, context, mutation) => {
if (mutation.state.data !== undefined) {
toast.error(`Something went wrong: ${getErrorMessage(error)}`);
//@ts-expect-error ignore expected error
toast.error(getErrorMessage(error?.response?.errors?.[0]));
}
},
}),
Expand Down

0 comments on commit f78a2bb

Please sign in to comment.