use alloc::string::{String, ToString};
use serde::{Deserialize, Serialize};
use snafu::Snafu;
#[derive(Snafu, Debug, Eq, PartialEq, Serialize, Deserialize)]
pub enum PoSQLTimestampError {
#[snafu(display("invalid timezone string: {timezone}"))]
InvalidTimezone {
timezone: String,
},
#[snafu(display("invalid timezone offset"))]
InvalidTimezoneOffset,
#[snafu(display("Invalid time unit"))]
InvalidTimeUnit {
error: String,
},
#[snafu(display("Local time does not exist because there is a gap in the local time"))]
LocalTimeDoesNotExist,
#[snafu(display("Unix timestamp is ambiguous because there is a fold in the local time."))]
Ambiguous {
error: String,
},
#[snafu(display("Timestamp parsing error: {error}"))]
ParsingError {
error: String,
},
#[snafu(display("Unsupported precision for timestamp: {error}"))]
UnsupportedPrecision {
error: String,
},
}
impl From<PoSQLTimestampError> for String {
fn from(error: PoSQLTimestampError) -> Self {
error.to_string()
}
}