You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mediarepo/mediarepo-api/src/daemon_management/error.rs

31 lines
593 B
Rust

use std::fmt::{Display, Formatter};
pub type DaemonResult<T> = Result<T, DaemonError>;
#[derive(Debug)]
pub struct DaemonError {
pub message: String,
}
impl Display for DaemonError {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
self.message.fmt(f)
}
}
impl std::error::Error for DaemonError {}
impl From<std::io::Error> for DaemonError {
fn from(e: std::io::Error) -> Self {
Self {
message: e.to_string(),
}
}
}
impl From<String> for DaemonError {
fn from(s: String) -> Self {
Self { message: s }
}
}