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

@@ -45,12 +45,7 @@ pub async fn create_release_attachment(
if response.status().is_success() {
// TODO: create a struct Attachment and return it to the caller.
} else if response.status().is_client_error() {
let mesg = response
.json::<ApiError>()
.await
.map_err(|reqwest_err| {
crate::Error::WrappedReqwestErr(reqwest_err)
})?;
let mesg = crate::decode_client_error(response).await?;
return Err(crate::Error::ApiErrorMessage(mesg));
}
}