-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
useFetch: [Feature request] Expose whole the http response on error (in onFetchError) #1144
Comments
I would like to point out one thing that I noticed. Like you mentioned, right now, we only have But the
While the I would say we're supposed to utilize our handlers in An example of
|
Thanks. This may be a workaround for now. It would be convenient to get response (especially status code and url) in |
Going to reopen this as I would like to include it. I'll see if I can get around to it soon |
@Delicious-Bacon, you should note that the documentation states that afterFetch() is only run on 2xx status codes, not after each fetch (currently has an open pull request to correctly implement this (#1266)). This makes it even more important to have access to the extra data such as the status code in the ctx argument of onFetchError(), because errors shouldn't even appear in the afterFetch() hook. |
It seems that the design of Then, #1266 was opened because the "doc" was not matching the code, but the PR #1271 linked to this kind of revert #572, since it checks the status code and doesn't call And now, we all have the same issue: we need to have the full response to do some useful interceptions. So we can either:
I don't have strong opinions on this. But we need one of those. |
Please consider expose the whole http response in onFetchError.
e.g. ctx.error.response (like axios did)
Currently, there's nothing useful in ctx of onFetchError, I can't even get status code nor url.
It's really hard to customize a useful error handler middleware without key information.
Feature request:
The text was updated successfully, but these errors were encountered: