From ae5071a309617135124c77b6a530a56e943ef3b5 Mon Sep 17 00:00:00 2001 From: se2crid <151872490+se2crid@users.noreply.github.com> Date: Sat, 20 Dec 2025 21:31:30 +0100 Subject: [PATCH] Include ErrorDescription in unknown device errors (#46) * Include ErrorDescription in unknown device errors * Remove unused error import from tracing --- idevice/src/lib.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/idevice/src/lib.rs b/idevice/src/lib.rs index cacd0de..cb62deb 100644 --- a/idevice/src/lib.rs +++ b/idevice/src/lib.rs @@ -38,7 +38,7 @@ use std::{ }; use thiserror::Error; use tokio::io::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt}; -use tracing::{debug, error, trace}; +use tracing::{debug, trace}; pub use util::{pretty_print_dictionary, pretty_print_plist}; @@ -482,7 +482,13 @@ impl Idevice { if let Some(e) = IdeviceError::from_device_error_type(e.as_str(), &res) { return Err(e); } else { - return Err(IdeviceError::UnknownErrorType(e)); + let msg = + if let Some(desc) = res.get("ErrorDescription").and_then(|x| x.as_string()) { + format!("{} ({})", e, desc) + } else { + e + }; + return Err(IdeviceError::UnknownErrorType(msg)); } } Ok(res)