Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strange response error #526

Closed
thejimbow opened this issue Sep 8, 2021 · 1 comment
Closed

Strange response error #526

thejimbow opened this issue Sep 8, 2021 · 1 comment

Comments

@thejimbow
Copy link

I use an API that returns details with errors
like below
{ props:{ message:' Something bad occured ', code:1023 } }

and I also use Typescript and when I wrap my API calls to try/catch block
only returns an Error() object which only has message(if 400 be like: Request failed with 400 or something)
is there anyway I can access the response in try/catch ?

@pi0
Copy link
Member

pi0 commented Oct 25, 2021

You can use error.reponse. See docs: https://github.com/axios/axios#handling-errors

@pi0 pi0 closed this as completed Oct 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants