mirror of
https://github.com/YGGverse/ggemini.git
synced 2026-03-31 17:15:31 +00:00
update permanent status codes api
This commit is contained in:
parent
0c75da793f
commit
e96ff688b3
14 changed files with 644 additions and 158 deletions
|
|
@ -1,22 +1,47 @@
|
|||
use std::{
|
||||
fmt::{Display, Formatter, Result},
|
||||
str::Utf8Error,
|
||||
};
|
||||
use std::fmt::{Display, Formatter, Result};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum Error {
|
||||
Code,
|
||||
Utf8Error(Utf8Error),
|
||||
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::Code => {
|
||||
write!(f, "Status code error")
|
||||
Self::BadRequest(e) => {
|
||||
write!(f, "BadRequest parse error: {e}")
|
||||
}
|
||||
Self::Utf8Error(e) => {
|
||||
write!(f, "UTF-8 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")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue