Skip to content

Get error response object #1463

Answered by TkDodo
fiskpatte asked this question in General
Dec 17, 2020 · 3 comments · 13 replies
Discussion options

You must be logged in to vote

It depends on what you are using for data fetching, react-query is completely agnostic in that regard.

  • If you are using axios, it will give you an AxiosError which has the json body somewhere in error.response.data or so.
  • If you are using fetch, you have to json parse the body yourselves via error.response.json().
  • If you are using something else, I don't know, please consult the docs of your fetching library :)

Replies: 3 comments 13 replies

Comment options

You must be logged in to vote
12 replies
@TkDodo
Comment options

@wonghin
Comment options

@wonghin
Comment options

@onlyhasbi
Comment options

@Queen-esther01
Comment options

Answer selected by louis-young
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@TkDodo
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet