update Response API

This commit is contained in:
yggverse 2025-02-02 22:12:40 +02:00
parent cdac038135
commit 5358e43697
25 changed files with 1102 additions and 502 deletions

View file

@ -1,19 +1,50 @@
use std::fmt::{Display, Formatter, Result};
use std::{
fmt::{Display, Formatter, Result},
str::Utf8Error,
};
#[derive(Debug)]
pub enum Error {
Meta(super::meta::Error),
Stream,
Certificate(super::certificate::Error),
Code(u8),
Failure(super::failure::Error),
Input(super::input::Error),
Protocol,
Redirect(super::redirect::Error),
Stream(glib::Error, Vec<u8>),
Success(super::success::Error),
Utf8Error(Utf8Error),
}
impl Display for Error {
fn fmt(&self, f: &mut Formatter) -> Result {
match self {
Self::Meta(e) => {
write!(f, "Meta read error: {e}")
Self::Certificate(e) => {
write!(f, "Certificate error: {e}")
}
Self::Stream => {
write!(f, "I/O stream error")
Self::Code(e) => {
write!(f, "Code group error: {e}*")
}
Self::Failure(e) => {
write!(f, "Failure error: {e}")
}
Self::Input(e) => {
write!(f, "Input error: {e}")
}
Self::Protocol => {
write!(f, "Protocol error")
}
Self::Redirect(e) => {
write!(f, "Redirect error: {e}")
}
Self::Stream(e, ..) => {
write!(f, "I/O stream error: {e}")
}
Self::Success(e) => {
write!(f, "Success error: {e}")
}
Self::Utf8Error(e) => {
write!(f, "UTF-8 decode error: {e}")
}
}
}