Construct the response to listing the tree in gitea.

This commit is contained in:
Tom Alexander
2024-09-28 14:00:00 -04:00
parent 71f9e10600
commit 201709c360
2 changed files with 57 additions and 11 deletions

25
src/gitea_client/error.rs Normal file
View File

@@ -0,0 +1,25 @@
use std::error::Error;
#[derive(Debug, Clone)]
pub(crate) enum GiteaClientError {
Static(#[allow(dead_code)] &'static str),
String(#[allow(dead_code)] String),
NoTotalCountHeaderInResponse,
}
impl std::fmt::Display for GiteaClientError {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
match self {
GiteaClientError::Static(s) => write!(f, "GiteaClientError: {}", s),
GiteaClientError::String(s) => write!(f, "GiteaClientError: {}", s),
GiteaClientError::NoTotalCountHeaderInResponse => {
write!(
f,
"GiteaClientError: No x-total-count header returned in gitea response.",
)
}
}
}
}
impl Error for GiteaClientError {}