agent_rules_tool/error.rs
1//! Error types returned by parse, lint, migrate, and I/O operations.
2
3use thiserror::Error;
4
5/// Error returned by library and CLI operations.
6#[derive(Debug, Error)]
7pub enum Error {
8 /// Markdown frontmatter could not be parsed.
9 #[error("parse error: {0}")]
10 Parse(#[from] markdown_frontmatter::Error),
11
12 /// JSON Schema compilation or validation failed unexpectedly.
13 #[error("schema error: {0}")]
14 Schema(String),
15
16 /// File or directory I/O failed.
17 #[error("io error: {0}")]
18 Io(#[from] std::io::Error),
19
20 /// YAML serialization or deserialization failed.
21 #[error("yaml error: {0}")]
22 Yaml(String),
23
24 /// JSON parsing failed.
25 #[error("json error: {0}")]
26 Json(#[from] serde_json::Error),
27
28 /// Migration between formats failed.
29 #[error("migrate error: {0}")]
30 Migrate(String),
31
32 /// Caller input was invalid (missing fields, unsupported combination, etc.).
33 #[error("invalid input: {0}")]
34 InvalidInput(String),
35}