-
-
Notifications
You must be signed in to change notification settings - Fork 99
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
How to get error json response? #171
Comments
Hey @SharkFourSix,
You can call the |
Thanks. 👍 That worked. I was about to switch to axios because of that that little inconvenience which can build up into lots of boilerplate code 😅 |
Bump... So it appears that this applies to all the error "catchers"? Is there a way to only call the parsing on demand in the handlers? Because as it appears I have to design my API to always return a JSON response, again, something which is counterintuitive :/ I'm getting a JSON conversion error because some responses are only returning standard HTTP responses without any additional JSON data. Can't you only parse JSON by looking at the content-type response? |
Absolutely, I fully agree 👍.
No, but this is an excellent idea! I just released The |
Cool. That was quick too. 👍 |
According to this https://github.com/elbywan/wretch#catchers- , I should be able to get a response JSON object even during errors. However, the error parameter does not have a
.json
property. The.text
property is present but having to serialize to JSON manually is very counterintuitive.Perhaps there is another way that I'm not aware of?
The text was updated successfully, but these errors were encountered: