ofetch
ofetch copied to clipboard
onRequestError should called only once when retry?
Describe the feature
The context is that I have disabled the Wi-Fi on the computer, which will definitely trigger the onRequestError hook. Currently, for GET requests, there is a default retry of 1 time, and each retry will execute onRequestError. Because I display a pop-up window with the error message in onRequestError, there are two pop-up windows for each request.
I understand that the retry mechanism should be transparent to the business, and the business does not care how many times it has been retried. The business only cares whether the API ultimately succeeds or fails. Therefore, I suggest that exception hooks such as onRequestError and onResponseError should not be executed repeatedly during retries.
Of course, this is just my personal understanding. If there is any misunderstanding on my part, please feel free to disregard this request.
Additional information
- [ ] Would you be willing to help implement this feature?
I have the same issue, onResponseError
gets called twice, because of retry, so 2 popups get shown to the users.
Ideally it either gets called once, or we have a way of knowing if that's the last retry or if there are more pending.