Skip to main content

whichtime_sys/
error.rs

1//! Error types for whichtime-sys
2
3use thiserror::Error;
4
5/// Convenience result type used throughout `whichtime-sys`.
6pub type Result<T> = std::result::Result<T, Error>;
7
8/// Error values returned by parsing and locale setup code.
9#[derive(Error, Debug)]
10pub enum Error {
11    /// The requested locale code or name is not supported.
12    #[error("Locale not found: {0}")]
13    LocaleNotFound(String),
14    /// A regex used by the parsing pipeline failed to compile or execute.
15    #[error("Regex error: {0}")]
16    Regex(#[from] regex::Error),
17    /// Parsed components could not be turned into a valid date/time.
18    #[error("Invalid date/time: {0}")]
19    InvalidDateTime(String),
20    /// Generic parser failure.
21    #[error("Parse error: {0}")]
22    Parse(String),
23}