use serde::Serialize; #[derive(Debug, Serialize)] pub struct AppError { pub message: String, } impl From for AppError { fn from(e: rusqlite::Error) -> Self { AppError { message: e.to_string(), } } } impl From for AppError { fn from(e: std::io::Error) -> Self { AppError { message: e.to_string(), } } } impl From for AppError { fn from(s: String) -> Self { AppError { message: s } } } impl std::fmt::Display for AppError { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(f, "{}", self.message) } } impl std::error::Error for AppError {}