//! Workspace-wide error type and result alias. //! //! Specific component errors funnel into `AutopilotError` at crate boundaries; //! internal modules may use their own narrower error types but MUST convert at //! the public API surface. use thiserror::Error; #[derive(Debug, Error)] pub enum AutopilotError { #[error("configuration error: {0}")] Config(String), #[error("I/O error: {0}")] Io(#[from] std::io::Error), #[error("serialization error: {0}")] Serialization(String), #[error("missing dependency: {0}")] MissingDependency(String), #[error("not implemented: {0}")] NotImplemented(&'static str), #[error("network error: {0}")] Network(String), #[error("protocol error: {0}")] Protocol(String), #[error("validation failed: {0}")] Validation(String), #[error("internal error: {0}")] Internal(String), } pub type Result = std::result::Result; impl From for AutopilotError { fn from(value: serde_json::Error) -> Self { AutopilotError::Serialization(value.to_string()) } } impl From for AutopilotError { fn from(value: toml::de::Error) -> Self { AutopilotError::Config(value.to_string()) } }