mdbook_content_collections/
error.rs1use std::path::PathBuf;
2use thiserror::Error;
3
4#[derive(Debug, Error)]
5pub enum ContentError {
6 #[error("failed to read markdown file {path}: {source}")]
7 ReadFile {
8 path: PathBuf,
9 #[source]
10 source: std::io::Error,
11 },
12
13 #[error("could not determine a title from file path {0}")]
14 InvalidFileStem(PathBuf),
15
16 #[error("failed to create output directory {path}: {source}")]
17 CreateOutputDir {
18 path: PathBuf,
19 #[source]
20 source: std::io::Error,
21 },
22
23 #[error("failed to serialize content index: {0}")]
24 Serialize(#[from] serde_json::Error),
25
26 #[error("failed to write content index to {path}: {source}")]
27 WriteOutput {
28 path: PathBuf,
29 #[source]
30 source: std::io::Error,
31 },
32 #[error("could not determine a file stem (title) from path {0}")]
33 MissingFileStem(PathBuf),
34}
35
36pub type Result<T> = std::result::Result<T, ContentError>;