mirror of
https://github.com/tinyhumansai/openhuman.git
synced 2026-07-27 21:08:00 +00:00
fix(team): preserve anyhow cause chain in backend RPC error envelopes (OPENHUMAN-TAURI-AD) (#1647)
This commit is contained in:
@@ -63,11 +63,22 @@ async fn get_authed_value(
|
||||
) -> Result<Value, String> {
|
||||
let token = require_token(config)?;
|
||||
let api_url = effective_api_url(&config.api_url);
|
||||
let client = BackendOAuthClient::new(&api_url).map_err(|e| e.to_string())?;
|
||||
let client = BackendOAuthClient::new(&api_url).map_err(|e| format!("{e:#}"))?;
|
||||
// `{e:#}` renders the full anyhow chain. `authed_json` wraps the
|
||||
// underlying reqwest error with `.context(format!("backend request {} {}", …))`
|
||||
// (`api/rest.rs::authed_json`), so plain `e.to_string()` only emits
|
||||
// the outer "backend request GET /teams" label and drops the cause
|
||||
// (connect timeout, DNS failure, TLS handshake, non-2xx status, …)
|
||||
// before the JSON-RPC layer reports it to Sentry. OPENHUMAN-TAURI-AD
|
||||
// is the canonical instance: 2 events on `0.53.35` from a Russia
|
||||
// user, all with the truncated label and elapsed_ms=49 — far too
|
||||
// short for a real timeout, so the underlying cause is the only
|
||||
// signal worth surfacing. Same failure mode the `report_error`
|
||||
// doc-string in `core/observability.rs` calls out (TAURI-B2).
|
||||
client
|
||||
.authed_json(&token, method, path, body)
|
||||
.await
|
||||
.map_err(|e| e.to_string())
|
||||
.map_err(|e| format!("{e:#}"))
|
||||
}
|
||||
|
||||
pub async fn get_usage(config: &Config) -> Result<RpcOutcome<Value>, String> {
|
||||
|
||||
Reference in New Issue
Block a user