-
Notifications
You must be signed in to change notification settings - Fork 85
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
Retry: Retry If Retruned Object Meets a Condition #45
Comments
IMO, it would be ideal to the function called throw an But I can see that something like package:http won't throw on 5xx responses, you if you want to retry those, this would be pretty neat. |
quick note: I wonder if we could call it |
|
Maybe we could just rename the parameters to be more descriptive, for example: final response = await retry(
// Make a GET request
() => http.get('https://google.com'),
// Retry on Exception
retryOnException: (e) => e is SocketException,
retryOnSuccess: (o) => o == "retry-please"
); |
That's exactly the thing I missed/ I'd like to suggest! I like @Ascenio's idea to rename the parameters (although it is a breaking change, which requires users to adjust their code). I'd prefer an even 'simpler' renaming like the following:
This would have been the 'intuitive' API I would have expected on my first use. |
How about: We don't break anything this way |
any news ? |
Hi,
I'd like to retry if the returned object meets a condition.
Example:
is this possible?
Thanks
The text was updated successfully, but these errors were encountered: