Skip to content

Conversation

@krushnarout
Copy link
Member

Network request fails with ClientException with SocketException after retries complete and the error is thrown at throw lastError!;

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request effectively resolves an issue where ClientException was not being handled by the retry logic in HttpPoolManager. The addition of a specific catch block for http.ClientException ensures these errors are now retried, enhancing the application's network resilience. Furthermore, the change from throw lastError! to throw lastError ?? Exception(...) is a good defensive improvement, preventing potential null reference errors if the retry loop doesn't execute. The changes are correct and improve the robustness of the code.

@aaravgarg aaravgarg requested a review from mdmohsin7 December 19, 2025 15:16
@beastoin
Copy link
Collaborator

You mean the lastError was null?

@krushnarout
Copy link
Member Author

You mean the lastError was null?

yes, the retry loop could exit with lastError == null, causing a crash when throw lastError! was reached

@mdmohsin7 mdmohsin7 merged commit 52e16ba into main Jan 3, 2026
1 check passed
@mdmohsin7 mdmohsin7 deleted the fix/client-exception-3831 branch January 3, 2026 05:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FlutterError - ClientException with SocketException - HttpPoolManager._executeWithRetry

4 participants