mirror of
https://github.com/YGGverse/ggemini.git
synced 2026-03-31 09:05:45 +00:00
48 lines
1.4 KiB
Rust
48 lines
1.4 KiB
Rust
use std::fmt::{Display, Formatter, Result};
|
|
|
|
#[derive(Debug)]
|
|
pub enum Error {
|
|
BadRequest(super::bad_request::Error),
|
|
Default(super::default::Error),
|
|
FirstByte(u8),
|
|
Gone(super::gone::Error),
|
|
NotFound(super::not_found::Error),
|
|
ProxyRequestRefused(super::proxy_request_refused::Error),
|
|
SecondByte(u8),
|
|
UndefinedFirstByte,
|
|
UndefinedSecondByte,
|
|
}
|
|
|
|
impl Display for Error {
|
|
fn fmt(&self, f: &mut Formatter) -> Result {
|
|
match self {
|
|
Self::BadRequest(e) => {
|
|
write!(f, "BadRequest parse error: {e}")
|
|
}
|
|
Self::Default(e) => {
|
|
write!(f, "Default parse error: {e}")
|
|
}
|
|
Self::FirstByte(b) => {
|
|
write!(f, "Unexpected first byte: {b}")
|
|
}
|
|
Self::Gone(e) => {
|
|
write!(f, "Gone parse error: {e}")
|
|
}
|
|
Self::NotFound(e) => {
|
|
write!(f, "NotFound parse error: {e}")
|
|
}
|
|
Self::ProxyRequestRefused(e) => {
|
|
write!(f, "ProxyRequestRefused parse error: {e}")
|
|
}
|
|
Self::SecondByte(b) => {
|
|
write!(f, "Unexpected second byte: {b}")
|
|
}
|
|
Self::UndefinedFirstByte => {
|
|
write!(f, "Undefined first byte")
|
|
}
|
|
Self::UndefinedSecondByte => {
|
|
write!(f, "Undefined second byte")
|
|
}
|
|
}
|
|
}
|
|
}
|