mirror of
https://github.com/block/buzz.git
synced 2026-08-18 06:50:31 +02:00
fix(desktop): stop labeling malformed relay responses as unreachable
parse_json_response tagged a 2xx response with an undeserializable body as "relay unreachable:", the same prefix used for genuine transport failures. The reconcile log-guard suppresses that prefix, so a reached-but- malformed response (protocol mismatch, relay bug, corrupted body) was being silently swallowed instead of surfaced. Re-prefix it to "relay returned malformed response:" so it falls outside the unreachable bucket and logs loudly; the frontend connectivity classifier also correctly stops treating it as a connectivity failure. No other code reads the old string. Co-authored-by: Will Pfleger <pfleger.will@gmail.com> Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
This commit is contained in:
co-authored by
Will Pfleger
parent
7c5b1f252e
commit
92f8f78b0e
@@ -211,11 +211,16 @@ pub(crate) async fn parse_json_response<T: DeserializeOwned>(
|
||||
return Err(msg);
|
||||
}
|
||||
|
||||
// Drop the reqwest error detail — it contains the raw URL.
|
||||
// A successful HTTP response whose body fails to deserialize means the relay
|
||||
// was reached but returned something unexpected (protocol mismatch, relay bug,
|
||||
// corrupted body) — NOT a connectivity failure. Keep it off the
|
||||
// "relay unreachable:" bucket so it surfaces loudly instead of being treated
|
||||
// as a transient unreachable-relay condition. The reqwest error detail is
|
||||
// dropped because it contains the raw URL.
|
||||
response
|
||||
.json::<T>()
|
||||
.await
|
||||
.map_err(|_| "relay unreachable: response was not valid JSON".to_string())
|
||||
.map_err(|_| "relay returned malformed response: not valid JSON".to_string())
|
||||
}
|
||||
|
||||
pub async fn relay_error_message(response: reqwest::Response) -> String {
|
||||
|
||||
Reference in New Issue
Block a user