Skip to main content

opencode_provider_manager/config_core/
error.rs

1use thiserror::Error;
2
3/// Errors that can occur during configuration operations.
4#[derive(Error, Debug)]
5pub enum ConfigError {
6    #[error("IO error: {0}")]
7    Io(#[from] std::io::Error),
8
9    #[error("JSON parse error: {0}")]
10    JsonParse(#[from] serde_json::Error),
11
12    #[error("JSONC parse error: {0}")]
13    JsoncParse(String),
14
15    #[error("Config file not found: {path}")]
16    FileNotFound { path: String },
17
18    #[error("Config validation error: {0}")]
19    Validation(String),
20
21    #[error("Merge conflict: {0}")]
22    MergeConflict(String),
23
24    #[error("Environment variable not found: {0}")]
25    EnvVarNotFound(String),
26
27    #[error("File not found for substitution: {0}")]
28    FileSubstitutionNotFound(String),
29
30    #[error("Permission denied: {path}")]
31    PermissionDenied { path: String },
32
33    #[error("Invalid config layer: {0}")]
34    InvalidLayer(String),
35
36    #[error("Schema error: {0}")]
37    Schema(String),
38}
39
40pub type Result<T> = std::result::Result<T, ConfigError>;