Skip to main content

rosetta_date/
error.rs

1use thiserror::Error;
2
3#[derive(Debug, Error)]
4pub enum RosettaError {
5    #[error("Failed to parse date: {0}")]
6    ParseError(String),
7
8    #[error("Failed to format date: {0}")]
9    FormatError(String),
10
11    #[error("Invalid timezone: {0}")]
12    TimezoneError(String),
13
14    #[error("Language not supported: {0}")]
15    UnsupportedLanguage(String),
16
17    #[cfg(feature = "time-backend")]
18    #[error("Time backend error: {0}")]
19    TimeError(#[from] time::error::Error),
20
21    #[cfg(feature = "time-backend")]
22    #[error("Time parse error: {0}")]
23    TimeParseError(#[from] time::error::Parse),
24
25    #[cfg(feature = "chrono-backend")]
26    #[error("Chrono parse error: {0}")]
27    ChronoParseError(#[from] chrono::ParseError),
28}
29
30pub type Result<T> = std::result::Result<T, RosettaError>;