diff --git a/core/src/client.rs b/core/src/client.rs index f4ef0f3a..6852b5e3 100644 --- a/core/src/client.rs +++ b/core/src/client.rs @@ -240,6 +240,7 @@ impl APIClient { let resp_err = QueryError { code: resp.status().as_u16(), message: resp.text().await?, + detail: None, }; return Err(Error::InvalidResponse(resp_err)); } @@ -274,6 +275,7 @@ impl APIClient { let resp_err = QueryError { code: resp.status().as_u16(), message: resp.text().await?, + detail: None, }; return Err(Error::InvalidResponse(resp_err)); } @@ -299,6 +301,7 @@ impl APIClient { let resp_err = QueryError { code: resp.status().as_u16(), message: format!("kill query failed: {}", resp.text().await?), + detail: None, }; return Err(Error::InvalidResponse(resp_err)); } @@ -431,6 +434,7 @@ impl APIClient { let resp_err = QueryError { code: resp.status().as_u16(), message: resp.text().await?, + detail: None, }; return Err(Error::InvalidResponse(resp_err)); } diff --git a/core/src/error.rs b/core/src/error.rs index 6108fd22..ab1006c2 100644 --- a/core/src/error.rs +++ b/core/src/error.rs @@ -35,9 +35,12 @@ impl std::fmt::Display for Error { Error::Request(msg) => write!(f, "RequestError: {msg}"), Error::IO(msg) => write!(f, "IOError: {msg}"), Error::SessionTimeout(msg) => write!(f, "SessionExpired: {msg}"), - Error::InvalidResponse(e) => { - write!(f, "ResponseError with {}: {}", e.code, e.message) - } + Error::InvalidResponse(e) => match &e.detail { + Some(d) if !d.is_empty() => { + write!(f, "ResponseError with {}: {}\n{}", e.code, e.message, d) + } + _ => write!(f, "ResponseError with {}: {}", e.code, e.message), + }, Error::InvalidPage(e) => write!(f, "PageError with {}: {}", e.code, e.message), } } diff --git a/core/src/response.rs b/core/src/response.rs index 1716b2df..8c577076 100644 --- a/core/src/response.rs +++ b/core/src/response.rs @@ -20,6 +20,7 @@ use crate::request::SessionConfig; pub struct QueryError { pub code: u16, pub message: String, + pub detail: Option, } #[derive(Deserialize, Debug)]