-
Notifications
You must be signed in to change notification settings - Fork 12
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
fix(dart): correctly rethrow 4xx errors #1859
Conversation
✅ Deploy Preview for api-clients-automation ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✗ The generated branch has been deleted.If the PR has been merged, you can check the generated code on the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can't melos bump the version ? I think it works for non generated file too no ?
@@ -61,7 +61,7 @@ final class RetryStrategy { | |||
host.failed(); | |||
errors.add(e); | |||
} on AlgoliaApiException catch (e) { | |||
if (e.statusCode / 100 == 4) rethrow; | |||
if (e.statusCode ~/ 100 == 4) rethrow; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what in hell is this operator ahah
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is that a divide but approximative that rounds? XD
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, it's JS effect 😅
In dart, when you divide an int
by and int
, (e.g. 403 / 100
) guess what you get ? the answer: 4.03
🤦♂️
The operator ~/
is to get an int
result 🥲
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤯 oh oki, I'd go with e.StatusCode >= 400 && e.StatusCode < 500
in general but if it works like this then it's nice
f2469c6
to
91f3fb2
Compare
91f3fb2
to
b39a2dd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
noice
algolia/api-clients-automation#1859 Co-authored-by: Mouaad Aallam <mouaad.aallam@algolia.com>
🧭 What and Why
The current error-throwing logic doesn't stop the retry operations, which it should.
Changes included:
Correctly detect
4xx
errors to immediately stop retrying calls.