datasynth_core/country/
error.rs1use thiserror::Error;
4
5#[derive(Error, Debug)]
7pub enum CountryPackError {
8 #[error("Invalid country code: {0}")]
10 InvalidCountryCode(String),
11
12 #[error("Failed to parse country pack: {0}")]
14 ParseError(String),
15
16 #[error("Merge error: {0}")]
18 MergeError(String),
19
20 #[error("Directory error: {0}")]
22 DirectoryError(String),
23
24 #[error("Schema version mismatch: expected {expected}, found {found}")]
26 SchemaVersionMismatch { expected: String, found: String },
27}
28
29impl CountryPackError {
30 pub fn parse(msg: impl Into<String>) -> Self {
31 Self::ParseError(msg.into())
32 }
33
34 pub fn merge(msg: impl Into<String>) -> Self {
35 Self::MergeError(msg.into())
36 }
37
38 pub fn directory(msg: impl Into<String>) -> Self {
39 Self::DirectoryError(msg.into())
40 }
41}