Skip to main content

mig_bo4e/
error.rs

1use thiserror::Error;
2
3#[derive(Error, Debug)]
4pub enum MappingError {
5    #[error("TOML parse error in {file}: {message}")]
6    TomlParse { file: String, message: String },
7
8    #[error("Invalid mapping path '{path}' in {file}: {reason}")]
9    InvalidPath {
10        path: String,
11        file: String,
12        reason: String,
13    },
14
15    #[error("Unknown handler '{name}' referenced in {file}")]
16    UnknownHandler { name: String, file: String },
17
18    #[error("Missing required field '{field}' during mapping")]
19    MissingField { field: String },
20
21    #[error("Type conversion error: {0}")]
22    TypeConversion(String),
23
24    #[error("IO error: {0}")]
25    Io(#[from] std::io::Error),
26
27    #[error("TOML deserialization error: {0}")]
28    Toml(#[from] toml::de::Error),
29
30    #[error("Cache write error: {path} — {message}")]
31    CacheWrite { path: String, message: String },
32
33    #[error("Cache read error: {path} — {message}")]
34    CacheRead { path: String, message: String },
35}