Skip to main content

potato_spec/
error.rs

1use potato_agent::AgentError;
2use thiserror::Error;
3
4#[derive(Debug, Error)]
5pub enum SpecError {
6    #[error("YAML parse error: {0}")]
7    Yaml(#[from] serde_yaml::Error),
8    #[error("IO error reading spec file: {0}")]
9    Io(#[from] std::io::Error),
10    #[error("unknown tool '{name}' referenced in spec — register it before loading")]
11    UnknownTool { name: String },
12    #[error("unknown callback '{name}' referenced in spec — register it before loading")]
13    UnknownCallback { name: String },
14    #[error("unknown agent ref '{id}' — define it in the agents section or inline")]
15    UnknownAgentRef { id: String },
16    #[error("agent build error: {0}")]
17    AgentBuild(#[from] AgentError),
18    #[error("invalid provider '{value}': {reason}")]
19    InvalidProvider { value: String, reason: String },
20    #[error("workflow build error for '{id}': {reason}")]
21    WorkflowBuild { id: String, reason: String },
22    #[error("failed to load prompt from '{path}': {reason}")]
23    PromptLoad { path: String, reason: String },
24}