-
Notifications
You must be signed in to change notification settings - Fork 0
fix: Transform network failures into specific TLS timeout #18
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
base: main
Are you sure you want to change the base?
Conversation
Summary of ChangesHello @thiyaguk09, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a significant improvement to error handling within the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
This pull request introduces error handling to transform specific network errors into a 408 TLS handshake timeout ApiError. The implementation in util.makeRequest is functionally correct, but I've suggested a minor refactoring to improve maintainability by using constants. The new tests, however, have a critical flaw: they stub the very function they are supposed to test and re-implement its logic, meaning the production code is not actually being tested. I've provided a single, comprehensive comment on the test file that explains this issue and also addresses code duplication and a confusing test setup, along with a suggested refactoring that fixes all these points.
mahendra-google
left a comment
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.
LGTM
|
/gemini review |
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.
Code Review
This pull request introduces error handling logic to transform network failures into specific TLS timeout ApiErrors. The changes include modifications to util.ts to intercept and transform raw errors like ECONNRESET, ETIMEDOUT, and generic timeout messages into a consistent ApiError. Additionally, new unit tests were added in util.ts to validate the new transformation logic. The review focuses on correctness and maintainability, with suggestions for code improvements and clarifications.
|
/gemini review |
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.
Code Review
This pull request introduces improved error handling for network and transport-layer failures in util.makeRequest, transforming them into consistent and actionable ApiError instances. This enhancement prevents the propagation of ambiguous, underlying network library errors and provides developers with clear, unified diagnostic messages. The changes include intercepting ECONNRESET, ETIMEDOUT, and generic timeout/TLS handshake errors, and converting them into ApiError with codes 408 or 503. Unit tests have been added to validate the new transformation logic.
Transforms raw network errors (ECONNRESET, ETIMEDOUT, timed out, and TLS handshake) into a specific ApiError (code 408) with a descriptive message regarding potential CPU starvation. This prevents misleading error propagation from the underlying request library.
Splits network error handling: uses 408 for timeouts (timed out, ETIMEDOUT, TLS handshake) and 503 for connection resets (ECONNRESET) to improve retry logic accuracy.
Converts raw ECONNRESET, ETIMEDOUT, and TLS handshake failures into a standard Error object with an informative message. This helps diagnose CPU starvation or misleading 401 errors.
Replaces repetitive test cases in `makeAuthenticatedRequest` and `makeRequest` with a single, data-driven test loop. This verifies all conditions (ECONNRESET, ETIMEDOUT, "timed out", "TLS handshake") with reduced code duplication and improved maintenance. ```
…ilures Separates specific network transport errors (`ETIMEDOUT`, `ECONNRESET`) from genuine TLS handshake failures. The previous approach incorrectly categorized lower-level connection issues as "TLS errors," leading to misleading diagnostics for end-users. This change ensures accurate reporting based on the error pattern: - "tls handshake": Protocol/certificate issue. - "etimedout" / "timed out": Network timeout/availability. - "econnreset": Connection forcefully reset by host/intermediary.
4d68ab1 to
264beb5
Compare
|
/gemini summary |
Summary of ChangesThis pull request significantly improves the error handling within the Highlights
Changelog
Activity
|
Description
Impact
Testing
Additional Information
Checklist
Fixes #