use std::io; use thiserror::Error; /// Backend error type #[derive(Error, Debug)] pub enum BackendError { #[error("IO error: {0}")] Io(#[from] io::Error), #[error("Task error: {0}")] Task(#[from] tokio::task::JoinError), #[error("General error: {0}")] General(String), } impl From<&str> for BackendError { fn from(s: &str) -> Self { Self::General(s.to_string()) } } impl From for BackendError { fn from(s: String) -> Self { Self::General(s) } } impl From for BackendError { fn from(e: anyhow::Error) -> Self { Self::General(e.to_string()) } } /// Result type for backend operations pub type Result = std::result::Result;