use core::fmt;
#[derive(Debug, Clone, PartialEq, Eq)]
#[non_exhaustive]
pub enum LogError {
InvalidArgument(String),
CreateFailed,
BridgeError(String),
}
impl LogError {
pub(crate) fn bridge(message: impl Into<String>) -> Self {
Self::BridgeError(message.into())
}
}
impl fmt::Display for LogError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::InvalidArgument(message) => write!(f, "invalid argument: {message}"),
Self::CreateFailed => write!(f, "bridge constructor returned NULL"),
Self::BridgeError(message) => write!(f, "bridge error: {message}"),
}
}
}
impl std::error::Error for LogError {}