Showing non-200 error details in UI #1136
-
I am using the hook useQuery to get remote data. For some reasons, the remove server might return fail status with some error message. I am not sure how would I catch those errors and show in UI for better user experience.
It works fine for success and failure response as I currently show generic failure response. How should I modify my For example, if status code is 4XX or 5XX, I want to get the response body to be shown in UI. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Both useQuery & useMutation have
|
Beta Was this translation helpful? Give feedback.
Both useQuery & useMutation have
error
property in returned result,Whatever value thrown from query function can be accessed from
error
.