pub enum Error {
UnexpectedResponse(serde_json::error::Error),
NetworkFailure,
}
fn fmt_config_error(err: &Error, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match &err {
Error::UnexpectedResponse(_) => write!(f, "Can't understand the response from the git forge."),
Error::NetworkFailure => write!(f, "Failed to communicate with the git forge."),
}
}
impl std::fmt::Debug for Error {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
fmt_config_error(&self, f)
}
}
impl core::fmt::Display for Error {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
fmt_config_error(&self, f)
}
}
impl std::error::Error for Error {}