1use core::fmt;
4
5#[derive(Debug, Clone, Copy, PartialEq, Eq)]
7#[non_exhaustive]
8pub enum Error {
9 NotFound,
11 BadData(&'static str),
13 BadZip(&'static str),
15 BadPosixTz(&'static str),
17}
18
19impl fmt::Display for Error {
20 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
21 match self {
22 Error::NotFound => f.write_str("timezone not found in embedded data"),
23 Error::BadData(why) => write!(f, "malformed timezone data: {why}"),
24 Error::BadZip(why) => write!(f, "malformed zip archive: {why}"),
25 Error::BadPosixTz(why) => write!(f, "malformed POSIX TZ string: {why}"),
26 }
27 }
28}
29
30impl core::error::Error for Error {}