Gurty -> usable state

This commit is contained in:
vt-d
2025-08-19 22:01:20 +05:30
parent 99f17dc42c
commit aa49fac5b8
24 changed files with 2679 additions and 394 deletions

38
protocol/cli/src/error.rs Normal file
View File

@@ -0,0 +1,38 @@
use std::fmt;
#[derive(Debug)]
pub enum ServerError {
Io(std::io::Error),
InvalidPath(String),
InvalidConfiguration(String),
TlsConfiguration(String),
ServerStartup(String),
}
impl fmt::Display for ServerError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
ServerError::Io(err) => write!(f, "I/O error: {}", err),
ServerError::InvalidPath(path) => write!(f, "Invalid path: {}", path),
ServerError::InvalidConfiguration(msg) => write!(f, "Configuration error: {}", msg),
ServerError::TlsConfiguration(msg) => write!(f, "TLS configuration error: {}", msg),
ServerError::ServerStartup(msg) => write!(f, "Server startup error: {}", msg),
}
}
}
impl std::error::Error for ServerError {}
impl From<std::io::Error> for ServerError {
fn from(err: std::io::Error) -> Self {
ServerError::Io(err)
}
}
impl From<gurt::GurtError> for ServerError {
fn from(err: gurt::GurtError) -> Self {
ServerError::ServerStartup(err.to_string())
}
}
pub type Result<T> = std::result::Result<T, ServerError>;