From 8799498eec61987a9a0a999f181c82c1a1219280 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moir=C3=A9?= Date: Fri, 16 Oct 2026 12:23:21 -0700 Subject: [PATCH] Add more informative error message when Apple returns non-2xx code on login --- crates/plume_core/src/auth/account/mod.rs | 15 +++++++++++++-- crates/plume_core/src/lib.rs | 9 +++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/crates/plume_core/src/auth/account/mod.rs b/crates/plume_core/src/auth/account/mod.rs index 83b135b7..142b9a2a 100644 --- a/crates/plume_core/src/auth/account/mod.rs +++ b/crates/plume_core/src/auth/account/mod.rs @@ -14,8 +14,19 @@ use crate::Error; pub async fn parse_response( res: Result, ) -> Result { - let res = res?.text().await?; - let res: plist::Dictionary = plist::from_bytes(res.as_bytes())?; + let res = res?; + let status = res.status(); + + if !status.is_success() { + return Err(Error::GeneralHttpError { + url: res.url().to_string(), + status: status.as_u16(), + // body: res.text().await?, + }) + } + + let text = res.text().await?; + let res: plist::Dictionary = plist::from_bytes(text.as_bytes())?; let res: plist::Value = res.get("Response").unwrap().to_owned(); match res { plist::Value::Dictionary(dict) => Ok(dict), diff --git a/crates/plume_core/src/lib.rs b/crates/plume_core/src/lib.rs index 3d438f9a..9c7776f4 100644 --- a/crates/plume_core/src/lib.rs +++ b/crates/plume_core/src/lib.rs @@ -26,6 +26,15 @@ pub enum Error { http_code: Option, message: String, }, + /// We don't print out the response content because it generally does not matter too much, + /// and if we display this in a menu then it will probably be way too big. + /// I leave it in for ease of debugging. + #[error("HTTP request error {status} attempting to connect to {url}")] + GeneralHttpError { + url: String, + status: u16, + // body: String, + }, #[error("Request to developer session failed")] DeveloperSessionRequestFailed, #[error("Authentication SRP error {0}: {1}")]