Skip to main content

merman_core/
error.rs

1use crate::detect::DetectTypeError;
2
3pub type Result<T> = std::result::Result<T, Error>;
4
5#[derive(Debug, thiserror::Error)]
6pub enum Error {
7    #[error(transparent)]
8    DetectType(#[from] DetectTypeError),
9
10    #[error("Unsupported diagram type: {diagram_type}")]
11    UnsupportedDiagram { diagram_type: String },
12
13    #[error("Diagram parse error ({diagram_type}): {message}")]
14    DiagramParse {
15        diagram_type: String,
16        message: String,
17    },
18
19    #[error(
20        "Malformed YAML front-matter. If you were trying to use a YAML front-matter, please ensure that you've correctly opened and closed the YAML front-matter with un-indented `---` blocks"
21    )]
22    MalformedFrontMatter,
23
24    #[error("Invalid directive JSON: {message}")]
25    InvalidDirectiveJson { message: String },
26
27    #[error("Invalid YAML front-matter: {message}")]
28    InvalidFrontMatterYaml { message: String },
29}