mirror of
https://github.com/YGGverse/ggemini.git
synced 2026-03-31 17:15:31 +00:00
draft new api version
This commit is contained in:
parent
67d486cc4d
commit
3a9e84a3d9
19 changed files with 490 additions and 87 deletions
36
src/client/error.rs
Normal file
36
src/client/error.rs
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
use std::fmt::{Display, Formatter, Result};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum Error {
|
||||
Connectable(String),
|
||||
Connection(super::connection::Error),
|
||||
Connect(glib::Error),
|
||||
Request(glib::Error),
|
||||
Response(super::response::Error),
|
||||
Write(glib::Error),
|
||||
}
|
||||
|
||||
impl Display for Error {
|
||||
fn fmt(&self, f: &mut Formatter) -> Result {
|
||||
match self {
|
||||
Self::Connectable(uri) => {
|
||||
write!(f, "Could not create connectable address for {uri}")
|
||||
}
|
||||
Self::Connection(reason) => {
|
||||
write!(f, "Connection error: {reason}")
|
||||
}
|
||||
Self::Connect(reason) => {
|
||||
write!(f, "Connect error: {reason}")
|
||||
}
|
||||
Self::Request(reason) => {
|
||||
write!(f, "Request error: {reason}")
|
||||
}
|
||||
Self::Response(reason) => {
|
||||
write!(f, "Response error: {reason}")
|
||||
}
|
||||
Self::Write(reason) => {
|
||||
write!(f, "I/O Write error: {reason}")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue