Skip to content

ref(server): Capture errors from backend servers in Sentry#525

Draft
jan-auer wants to merge 1 commit into
mainfrom
ref/backend-response-errors
Draft

ref(server): Capture errors from backend servers in Sentry#525
jan-auer wants to merge 1 commit into
mainfrom
ref/backend-response-errors

Conversation

@jan-auer

@jan-auer jan-auer commented Jun 26, 2026

Copy link
Copy Markdown
Member

When GCS or S3 returns a 4xx/5xx error, the response body contains a structured error message explaining why the request was rejected (e.g., "customTime must be after the current customTime"). Previously, calling error_for_status() discarded that body — only the HTTP status code survived into Sentry.

This introduces an extension trait on reqwest::Response that intercepts error responses before the body is lost. It auto-detects the response format via Content-Type (JSON for the GCS JSON API, XML for the GCS XML API and S3) and deserializes the error code and message directly. A new error variant carries the parsed details so they appear in Sentry via the tracing middleware's Display capture.

@codecov

codecov Bot commented Jun 26, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 20.00000% with 68 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.12%. Comparing base (824c05a) to head (ca4887d).

Files with missing lines Patch % Lines
objectstore-service/src/backend/response.rs 17.46% 52 Missing ⚠️
objectstore-service/src/backend/gcs.rs 33.33% 12 Missing ⚠️
objectstore-service/src/backend/s3_compatible.rs 0.00% 3 Missing ⚠️
objectstore-service/src/error.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #525      +/-   ##
==========================================
- Coverage   87.35%   87.12%   -0.23%     
==========================================
  Files          87       88       +1     
  Lines       14086    14131      +45     
==========================================
+ Hits        12305    12312       +7     
- Misses       1781     1819      +38     
Components Coverage Δ
Rust Backend 91.84% <20.00%> (-0.31%) ⬇️
Rust Client 79.89% <ø> (ø)
Python Client 88.70% <ø> (ø)

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment on lines +85 to +93
let (code, message) = if content_type.starts_with("application/json") {
parse_json_error(self).await
} else if content_type.starts_with("application/xml")
|| content_type.starts_with("text/xml")
{
parse_xml_error(self).await
} else {
parse_fallback(self).await
};

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is a first attempt, though I think we can further improve this.

@jan-auer jan-auer force-pushed the ref/backend-response-errors branch from ffd84e6 to ca4887d Compare June 26, 2026 13:11
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