-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Can't acess to useFetch response's body on error ? #526
Comments
I'll look into fixing this, thanks for the report |
also stumbled upon this (using the 5 beta) if (!fetchResponse.ok)
throw new Error(fetchResponse.message) to something like this: if (!fetchResponse.ok) {
const error = new Error(fetchResponse.statusText)
error.data = responseData
throw error
} then we could consume it via: onFetchError((e) => console.log(e.message, e.data) |
This was referenced Jun 10, 2021
5 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
On a HTTP 400 response sent by the server (missing required fields in a form), useFetch only pass the statusText to the Error object. source code
I'd like to access to the json body response where I can access to the details of the error (statusText is irrelevant in my case). Response's body is already consumed (Stream locked) and
data
object has not been populated since the error is thrown before it gets the chance.Is this some kind of non-fetch-standard issue and should I use useAxios instead ?
The text was updated successfully, but these errors were encountered: