Fold client-error-decode into a util function

This commit is contained in:
2025-06-07 23:40:58 -05:00
parent 0c70b584ba
commit 4a0addda67
3 changed files with 12 additions and 18 deletions

View File

@@ -10,6 +10,15 @@ pub struct ApiError {
url: String,
}
pub (crate) async fn decode_client_error(response: reqwest::Response) -> Result<ApiError> {
response
.json::<ApiError>()
.await
.map_err(|reqwest_err| {
crate::Error::WrappedReqwestErr(reqwest_err)
})
}
#[derive(Debug)]
pub enum Error {
Placeholder, // TODO: Enumerate error modes