-
-
Notifications
You must be signed in to change notification settings - Fork 368
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
[feature request] add hook onNetworkError #296
Comments
Are there any fix ? |
No, there is not; I don't think commenting "is there any fix" will bring this feature forward. A PR is always welcome :) Maybe a generic hook for all errors would be better? Like we do in Got. |
Thank for your reply |
The solution is pretty simple. You need to store an array of abort controllers, and if the first request fails (you can use |
As far as I know, there hasn't been any progress at WHATWG related to discrete error types for I think probably the best we can do in Ky, at least for now, is to act like any non-HTTP error is a network error. We could provide a hook for that. It would end up getting called for invalid fetch options too, not just network errors. That might be confusing. But it's doable. |
Not necessarily confusing, it would be pretty useful when attaching a logger. |
Thank you so much
Vào Th 6, 4 thg 12, 2020 vào lúc 17:18 Szymon Marczak <
notifications@github.com> đã viết:
… That might be confusing. But it's doable.
Not necessarily confusing, it would be pretty useful when attaching a
logger.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#296 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AGLTBEJI4EC7CVLN2N2SJ7DSTCZQZANCNFSM4TKBELZQ>
.
|
Struggled with this for the better part of a day, I'll leave this as a potential solution in case its useful. In my case I have a reusable client with circuit breaking which needs to know about timeouts & network errors, in addition to HTTP errors. Providing a wrapped fetch option at least gave me a way to observe those errors outside of hooks.
|
just as the title
because
afterResponse
is not invoked when there is a network error.The text was updated successfully, but these errors were encountered: