Skip to main content

platform/error/
config_error.rs

1//! 配置相关错误类型
2//!
3//! 定义所有与配置解析、验证、加载相关的错误
4
5use thiserror::Error;
6
7/// 配置相关错误
8#[derive(Error, Debug)]
9pub enum ConfigError {
10    #[error("Invalid configuration format: {message}")]
11    InvalidFormat { message: String },
12
13    #[error("Missing required field: {field}")]
14    MissingField { field: String },
15
16    #[error("Invalid value for field '{field}': {value}")]
17    InvalidValue { field: String, value: String },
18
19    #[error("Configuration file not found: {path}")]
20    FileNotFound { path: String },
21
22    #[error("Failed to parse configuration: {source}")]
23    ParseError {
24        #[source]
25        source: Box<dyn std::error::Error + Send + Sync>,
26    },
27
28    #[error("Environment variable error: {var}")]
29    EnvError { var: String },
30}