use std::path::PathBuf; use thiserror::Error; pub type Result = std::result::Result; #[derive(Debug, Error)] pub enum ServerError { #[error("failed to read {path}: {source}")] Io { path: PathBuf, source: std::io::Error, }, #[error("invalid schema config: {0}")] SchemaConfig(String), #[error("schema build failed: {0}")] SchemaBuild(#[from] tidaldb::schema::SchemaError), #[error("tidalDB error: {0}")] Tidal(#[from] tidaldb::TidalError), #[error("http server error: {0}")] Http(#[from] std::io::Error), #[error("bad request: {0}")] BadRequest(String), } impl ServerError { pub fn io(path: impl Into, source: std::io::Error) -> Self { Self::Io { path: path.into(), source, } } }