1use std::path::PathBuf;
4
5pub type Result<T> = std::result::Result<T, Error>;
7
8#[derive(Debug, thiserror::Error)]
10pub enum Error {
11 #[error("ADR directory not found. Run 'adrs init' to create one.")]
13 AdrDirNotFound,
14
15 #[error("ADR directory already exists: {0}")]
17 AdrDirExists(PathBuf),
18
19 #[error("ADR not found: {0}")]
21 AdrNotFound(String),
22
23 #[error("Multiple ADRs match '{query}': {matches:?}")]
25 AmbiguousAdr { query: String, matches: Vec<String> },
26
27 #[error("Invalid ADR number: {0}")]
29 InvalidNumber(String),
30
31 #[error("Invalid ADR format in {path}: {reason}")]
33 InvalidFormat { path: PathBuf, reason: String },
34
35 #[error("Missing required field '{field}' in {path}")]
37 MissingField { path: PathBuf, field: String },
38
39 #[error("Invalid status: {0}")]
41 InvalidStatus(String),
42
43 #[error("Invalid link format: {0}")]
45 InvalidLink(String),
46
47 #[error("Template not found: {0}")]
49 TemplateNotFound(String),
50
51 #[error("Template error: {0}")]
53 TemplateError(String),
54
55 #[error("Configuration error: {0}")]
57 ConfigError(String),
58
59 #[error("I/O error: {0}")]
61 Io(#[from] std::io::Error),
62
63 #[error("YAML error: {0}")]
65 Yaml(#[from] serde_yaml::Error),
66
67 #[error("TOML error: {0}")]
69 Toml(#[from] toml::de::Error),
70}