1
0
Fork 0

add source reqwest error to ForgejoError::BadStructure

This commit is contained in:
Cyborus 2023-11-19 13:09:32 -05:00
parent 16ffd5e330
commit 6728bc0b11
No known key found for this signature in database

View file

@ -27,7 +27,7 @@ pub enum ForgejoError {
#[error("API key should be ascii")]
KeyNotAscii,
#[error("the response from forgejo was not properly structured")]
BadStructure,
BadStructure(#[source] reqwest::Error),
#[error("unexpected status code {} {}", .0.as_u16(), .0.canonical_reason().unwrap_or(""))]
UnexpectedStatusCode(StatusCode),
#[error("{} {}: {}", .0.as_u16(), .0.canonical_reason().unwrap_or(""), .1)]
@ -37,7 +37,7 @@ pub enum ForgejoError {
impl From<reqwest::Error> for ForgejoError {
fn from(e: reqwest::Error) -> Self {
if e.is_decode() {
ForgejoError::BadStructure
ForgejoError::BadStructure(e)
} else {
ForgejoError::ReqwestError(e)
}