use std::fmt;
pub type SurfnetResult<T> = Result<T, SurfnetError>;
#[derive(Debug)]
pub enum SurfnetError {
PortAllocation(String),
Startup(String),
Runtime(String),
Cheatcode(String),
Aborted(String),
}
impl fmt::Display for SurfnetError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
SurfnetError::PortAllocation(msg) => write!(f, "port allocation failed: {msg}"),
SurfnetError::Startup(msg) => write!(f, "surfnet startup failed: {msg}"),
SurfnetError::Runtime(msg) => write!(f, "surfnet runtime error: {msg}"),
SurfnetError::Cheatcode(msg) => write!(f, "cheatcode failed: {msg}"),
SurfnetError::Aborted(msg) => write!(f, "surfnet aborted: {msg}"),
}
}
}
impl std::error::Error for SurfnetError {}