Skip to main content

abu_skill/
error.rs

1use std::path::PathBuf;
2
3#[derive(Debug, thiserror::Error)]
4pub enum SkillError {
5    #[error("io error: {0}")]
6    Io(#[from] std::io::Error),
7
8    #[error("yaml parse error: {0}")]
9    Yaml(#[from] serde_yaml::Error),
10
11    #[error("invalid skill frontmatter: {message}")]
12    InvalidFrontmatter { message: String },
13
14    #[error("missing required field `{field}`")]
15    MissingField { field: &'static str },
16
17    #[error("invalid skills root, expected directory: {0}")]
18    InvalidSkillsRoot(PathBuf),
19
20    #[error("skill validation error: {0}")]
21    Validation(String),
22
23    #[error("index error: {0}")]
24    IndexError(String),
25}
26
27pub type SkillResult<T> = Result<T, SkillError>;