actr_config/
error.rs

1//! Error types for actr-config
2
3use std::path::PathBuf;
4use thiserror::Error;
5
6/// Errors that can occur during configuration parsing and processing
7#[derive(Error, Debug)]
8pub enum ConfigError {
9    #[error("Failed to read file: {0}")]
10    IoError(#[from] std::io::Error),
11
12    #[error("Failed to parse TOML: {0}")]
13    TomlParseError(#[from] toml::de::Error),
14
15    #[error("Failed to serialize TOML: {0}")]
16    TomlSerializeError(#[from] toml::ser::Error),
17
18    #[error("Invalid URL: {0}")]
19    InvalidUrl(#[from] url::ParseError),
20
21    #[error("Proto file not found: {0}")]
22    ProtoFileNotFound(PathBuf, #[source] std::io::Error),
23
24    #[error("Missing required field: {0}")]
25    MissingField(&'static str),
26
27    #[error("Unsupported config edition: {0}")]
28    UnsupportedEdition(u32),
29
30    #[error("Edition mismatch in inheritance: parent={parent}, child={child}")]
31    EditionMismatch { parent: u32, child: u32 },
32
33    #[error("Invalid ACL configuration: {0}")]
34    InvalidAcl(String),
35
36    #[error("Configuration validation failed: {0}")]
37    ValidationError(String),
38
39    #[error("Invalid ActrType format: {0}")]
40    InvalidActrType(String),
41
42    #[error("Invalid routing rule: {0}")]
43    InvalidRoutingRule(String),
44
45    #[error("Invalid dependency configuration: {0}")]
46    InvalidDependency(String),
47}
48
49pub type Result<T> = std::result::Result<T, ConfigError>;
50
51// Backward compatibility alias
52#[deprecated(since = "0.2.0", note = "Use ConfigError instead")]
53pub type ActrConfigError = ConfigError;