Skip to main content

edifact_mapper/
error.rs

1//! Error types for the edifact-mapper facade crate.
2
3/// Errors that can occur when using the [`Mapper`](crate::Mapper) API.
4#[derive(Debug, thiserror::Error)]
5pub enum MapperError {
6    /// The specified data directory does not exist on disk.
7    #[error("Data directory not found: {path}")]
8    DataDirNotFound { path: String },
9
10    /// No data bundle file found for the requested format version.
11    #[error("No data bundle found for format version {fv}")]
12    BundleNotFound { fv: String },
13
14    /// The requested variant (e.g., "UTILMD_Strom") is not present in the bundle.
15    #[error("No variant '{variant}' in bundle for {fv}")]
16    VariantNotFound { fv: String, variant: String },
17
18    /// No mapping engine definitions exist for the given PID within the variant.
19    #[error("No mapping engine for PID {pid} in {fv}/{variant}")]
20    PidNotFound {
21        fv: String,
22        variant: String,
23        pid: String,
24    },
25
26    /// An error from the MIG assembly layer.
27    #[error("Assembly error: {0}")]
28    Assembly(#[from] mig_assembly::AssemblyError),
29
30    /// An error from the TOML mapping engine.
31    #[error("Mapping error: {0}")]
32    Mapping(#[from] mig_bo4e::MappingError),
33
34    /// A standard I/O error.
35    #[error("IO error: {0}")]
36    Io(#[from] std::io::Error),
37}