1use std::path::PathBuf;
2
3#[derive(Debug, thiserror::Error)]
4pub enum Error {
5 #[error("IO error: {0}")]
6 Io(#[from] std::io::Error),
7
8 #[error("JSON error: {0}")]
9 Json(#[from] serde_json::Error),
10
11 #[error("YAML error: {0}")]
12 Yaml(#[from] serde_yaml::Error),
13
14 #[error("Content directory not found: {0}")]
15 ContentDirNotFound(PathBuf),
16
17 #[error("Missing frontmatter field '{field}' in {path}")]
18 MissingFrontmatter { field: String, path: String },
19
20 #[error("Duplicate entry id '{0}'")]
21 DuplicateId(String),
22
23 #[error("Build errors:\n{0}")]
24 BuildErrors(String),
25
26 #[error("Config error: {0}")]
27 Config(String),
28
29 #[error("Entry not found: {0}")]
30 NotFound(String),
31}
32
33pub type Result<T> = std::result::Result<T, Error>;