Skip to content

fix: improve error logging in indexer-proxy request handler#640

Open
cool-firer wants to merge 1 commit into
mainfrom
fix/openzeppelin-health-issue
Open

fix: improve error logging in indexer-proxy request handler#640
cool-firer wants to merge 1 commit into
mainfrom
fix/openzeppelin-health-issue

Conversation

@cool-firer

@cool-firer cool-firer commented Mar 17, 2026

Copy link
Copy Markdown
Contributor
  • Add detailed error messages for different reqwest error types (timeout, connection, builder, redirect, status, request, body, decode)
  • Include HTTP status code in error messages when available
  • Bump utils version from 2.2.0 to 2.2.1
  • Bump proxy version from 2.10.1 to 2.10.2

This helps diagnose service exceptions and network issues more effectively.

Summary by CodeRabbit

Release Notes

  • Chores

    • Updated package versions
  • Bug Fixes

    • Enhanced error reporting with more detailed diagnostic messages when requests fail

- Add detailed error messages for different reqwest error types (timeout, connection, builder, redirect, status, request, body, decode)
- Include HTTP status code in error messages when available
- Bump utils version from 2.2.0 to 2.2.1
- Bump proxy version from 2.10.1 to 2.10.2

This helps diagnose service exceptions and network issues more effectively.
@coderabbitai

coderabbitai Bot commented Mar 17, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

Version bumps applied to two Rust crate manifests in the indexer-proxy module, alongside enhanced error handling in the request module that provides detailed error categorization and specific messages for various failure scenarios instead of generic responses.

Changes

Cohort / File(s) Summary
Version Bumps
apps/indexer-proxy/proxy/Cargo.toml, apps/indexer-proxy/utils/Cargo.toml
Incremented package versions: proxy 2.10.1 → 2.10.2, utils 2.2.0 → 2.2.1.
Error Handling Enhancement
apps/indexer-proxy/utils/src/request.rs
Enhanced handle_request_raw to capture and categorize request errors (timeout, connect, builder, redirect, status, request, body, decode) with specific error messages instead of returning a generic static message.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A patch so neat, with errors clear,
Each failure type we now can hear!
Timeouts, connects, and status codes—
Better messages light the debugging roads.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title accurately describes the main change: improved error logging/handling in the indexer-proxy request handler with detailed error messages for different error types.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/openzeppelin-health-issue
📝 Coding Plan
  • Generate coding plan for human review comments

Comment @coderabbitai help to get the list of available commands and usage tips.

Tip

You can enable review details to help with troubleshooting, context usage and more.

Enable the reviews.review_details setting to include review details such as the model used, the time taken for each step and more in the review comments.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
apps/indexer-proxy/utils/src/request.rs (1)

147-170: Reduce duplicated formatting and avoid dangling separators in error messages.

This block works, but the repeated format! branches increase maintenance cost and can emit messages ending with -- when no status is present.

♻️ Suggested cleanup
-        Err(e) => {
-            let status_info = e.status()
-                .map(|s| format!(" (status: {})", s))
-                .unwrap_or_default();
-            
-            let error_msg = if e.is_timeout() {
-                format!("Service exception or timeout: {} -- {}", e, status_info)
-            } else if e.is_connect() {
-                format!("Service exception or Connection error: {} -- {}", e, status_info)
-            } else if e.is_builder() {
-                format!("Service exception or builder error: {} -- {}", e, status_info)
-            } else if e.is_redirect() {
-                format!("Service exception or redirect error: {} -- {}", e, status_info)
-            } else if e.is_status() {
-                format!("Service exception or status error: {} -- {}", e, status_info)
-            } else if e.is_request() {
-                format!("Service exception or request error: {} -- {}", e, status_info)
-            } else if e.is_body() {
-                format!("Service exception or body error: {} -- {}", e, status_info)
-            } else if e.is_decode() {
-                format!("Service exception or decode error: {} -- {}", e, status_info)
-            } else {
-                format!("Service exception: {} -- {}", e, status_info)
-            };
+        Err(e) => {
+            let status_suffix = e
+                .status()
+                .map(|s| format!(" (status: {s})"))
+                .unwrap_or_default();
+
+            let category = if e.is_timeout() {
+                "timeout"
+            } else if e.is_connect() {
+                "connection"
+            } else if e.is_builder() {
+                "builder"
+            } else if e.is_redirect() {
+                "redirect"
+            } else if e.is_status() {
+                "status"
+            } else if e.is_request() {
+                "request"
+            } else if e.is_body() {
+                "body"
+            } else if e.is_decode() {
+                "decode"
+            } else {
+                "unknown"
+            };
+
+            let error_msg = format!("Service exception ({category}): {e}{status_suffix}");
 
             return Err(Error::GraphQLInternal(
                 1010,
                 error_msg,
             ))

Also applies to: 174-174

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/indexer-proxy/utils/src/request.rs` around lines 147 - 170, In the
Err(e) => block in request.rs, remove the duplicated format! branches by
building the error-kind label once (based on e.is_timeout(), e.is_connect(),
e.is_builder(), e.is_redirect(), e.is_status(), e.is_request(), e.is_body(),
e.is_decode() — e.g., "timeout", "connect", "builder", etc.), then construct
status_info only if e.status() is Some and append it with a separator (" -- ")
only when present; finally call format!("Service exception{}: {}",
optional_kind_prefix, e) or similar to produce a single message. Apply the same
consolidation to the similar branch referenced around line 174 to avoid repeated
formatting and trailing separators.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@apps/indexer-proxy/utils/src/request.rs`:
- Around line 147-170: In the Err(e) => block in request.rs, remove the
duplicated format! branches by building the error-kind label once (based on
e.is_timeout(), e.is_connect(), e.is_builder(), e.is_redirect(), e.is_status(),
e.is_request(), e.is_body(), e.is_decode() — e.g., "timeout", "connect",
"builder", etc.), then construct status_info only if e.status() is Some and
append it with a separator (" -- ") only when present; finally call
format!("Service exception{}: {}", optional_kind_prefix, e) or similar to
produce a single message. Apply the same consolidation to the similar branch
referenced around line 174 to avoid repeated formatting and trailing separators.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2a0e309a-e327-4335-9c23-5f22fb40bbd2

📥 Commits

Reviewing files that changed from the base of the PR and between bd1f717 and 2189bae.

📒 Files selected for processing (3)
  • apps/indexer-proxy/proxy/Cargo.toml
  • apps/indexer-proxy/utils/Cargo.toml
  • apps/indexer-proxy/utils/src/request.rs

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.

1 participant