ref(server): Capture errors from backend servers in Sentry#525
Draft
jan-auer wants to merge 1 commit into
Draft
Conversation
Codecov Report❌ Patch coverage is 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
☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
jan-auer
commented
Jun 26, 2026
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 | ||
| }; |
Member
Author
There was a problem hiding this comment.
This is a first attempt, though I think we can further improve this.
ffd84e6 to
ca4887d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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::Responsethat intercepts error responses before the body is lost. It auto-detects the response format viaContent-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'sDisplaycapture.