28 lines
842 B
Rust
28 lines
842 B
Rust
use std::error::Error;
|
|
|
|
#[derive(Debug, Clone)]
|
|
pub(crate) enum GiteaClientError {
|
|
#[allow(dead_code)]
|
|
Static(#[allow(dead_code)] &'static str),
|
|
#[allow(dead_code)]
|
|
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 {}
|