draft new api version

This commit is contained in:
yggverse 2024-11-27 05:50:09 +02:00
parent 67d486cc4d
commit 3a9e84a3d9
19 changed files with 490 additions and 87 deletions

View file

@ -1,13 +1,33 @@
use std::fmt::{Display, Formatter, Result};
#[derive(Debug)]
pub enum Error {
DataDecode,
DataProtocol,
InputStream,
MimeDecode,
MimeProtocol,
MimeUndefined,
Data(super::data::Error),
InputStreamRead(Vec<u8>, glib::Error),
Mime(super::mime::Error),
Protocol,
StatusDecode,
StatusProtocol,
StatusUndefined,
Status(super::status::Error),
}
impl Display for Error {
fn fmt(&self, f: &mut Formatter) -> Result {
match self {
Self::Data(reason) => {
write!(f, "Data error: {reason}")
}
Self::InputStreamRead(_, reason) => {
// @TODO
write!(f, "Input stream error: {reason}")
}
Self::Mime(reason) => {
write!(f, "MIME error: {reason}")
}
Self::Protocol => {
write!(f, "Protocol error")
}
Self::Status(reason) => {
write!(f, "Status error: {reason}")
}
}
}
}