Skip to main content

aether_project/
error.rs

1//! Error types for settings loading and validation.
2
3use thiserror::Error;
4
5/// Errors that can occur during settings loading and agent resolution.
6#[derive(Debug, Error)]
7pub enum SettingsError {
8    /// The settings file exists but could not be parsed.
9    #[error("Failed to parse settings file: {0}")]
10    ParseError(String),
11
12    /// An agent entry has an invalid model string.
13    #[error("Invalid model '{model}' for agent '{agent}': {error}")]
14    InvalidModel { agent: String, model: String, error: String },
15
16    /// An agent entry is missing required fields.
17    #[error("Agent '{agent}' is missing required field: {field}")]
18    MissingField { agent: String, field: String },
19
20    /// An agent entry has an empty name.
21    #[error("Agent at index {index} has an empty name")]
22    EmptyAgentName { index: usize },
23
24    /// An agent entry uses a reserved name.
25    #[error("Agent name '{name}' is reserved and cannot be used")]
26    ReservedAgentName { name: String },
27
28    /// Duplicate agent names.
29    #[error("Duplicate agent name: '{name}'")]
30    DuplicateAgentName { name: String },
31
32    /// An agent has no invocation surface enabled.
33    #[error("Agent '{agent}' must have at least one invocation flag (userInvocable or agentInvocable)")]
34    NoInvocationSurface { agent: String },
35
36    /// A prompt glob pattern is syntactically invalid.
37    #[error("Invalid glob pattern '{pattern}' for agent '{agent}': {error}")]
38    InvalidGlobPattern { agent: String, pattern: String, error: String },
39
40    /// An inherited prompt glob pattern is syntactically invalid.
41    #[error("Invalid inherited glob pattern '{pattern}': {error}")]
42    InvalidInheritedGlobPattern { pattern: String, error: String },
43
44    /// A prompt entry resolves to zero files.
45    #[error("Prompt entry '{pattern}' for agent '{agent}' resolves to no files")]
46    ZeroMatchPrompt { agent: String, pattern: String },
47
48    /// An inherited prompt entry resolves to zero files.
49    #[error("Inherited prompt entry '{pattern}' resolves to no files")]
50    ZeroMatchInheritedPrompt { pattern: String },
51
52    /// An agent has no prompts after inheritance.
53    #[error("Agent '{agent}' has no prompts after inheritance (neither inherited nor local)")]
54    NoPrompts { agent: String },
55
56    /// An MCP config path does not exist or is invalid.
57    #[error("MCP config path '{path}' does not exist or is not a file")]
58    InvalidMcpConfigPath { path: String },
59
60    /// I/O error while reading files.
61    #[error("I/O error: {0}")]
62    IoError(String),
63
64    /// An agent was not found in the catalog.
65    #[error("Agent '{name}' not found")]
66    AgentNotFound { name: String },
67
68    /// Duplicate prompt names in the catalog.
69    #[error("Duplicate prompt name: '{name}'")]
70    DuplicatePromptName { name: String },
71}