Skip to main content

mermaid_builder/
errors.rs

1//! Submodule defining the possible errors that can occur in the Mermaid
2//! library.
3
4use thiserror::Error;
5
6mod config_error;
7pub use config_error::ConfigError;
8mod edge_error;
9pub use edge_error::EdgeError;
10mod node_error;
11pub use node_error::NodeError;
12
13pub use crate::shared::style_class::StyleClassError;
14
15#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Error)]
16#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
17/// Enum representing the different types of errors that can occur in the
18/// Mermaid library.
19pub enum Error {
20    /// An error regarding nodes.
21    #[error("Node error: {0}")]
22    Node(#[from] NodeError),
23    /// An error regarding edges.
24    #[error("Edge error: {0}")]
25    Edge(#[from] EdgeError),
26    /// An error regarding diagram configuration.
27    #[error("Configuration error: {0}")]
28    Config(#[from] ConfigError),
29    /// An error regarding style classes.
30    #[error("Style class error: {0}")]
31    StyleClass(#[from] StyleClassError),
32}