1use core::fmt;
4
5#[derive(Debug, Clone, PartialEq, Eq)]
6#[non_exhaustive]
7pub enum LogError {
8 InvalidArgument(String),
10 CreateFailed,
12 BridgeError(String),
14}
15
16impl LogError {
17 pub(crate) fn bridge(message: impl Into<String>) -> Self {
18 Self::BridgeError(message.into())
19 }
20}
21
22impl fmt::Display for LogError {
23 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
24 match self {
25 Self::InvalidArgument(message) => write!(f, "invalid argument: {message}"),
26 Self::CreateFailed => write!(f, "bridge constructor returned NULL"),
27 Self::BridgeError(message) => write!(f, "bridge error: {message}"),
28 }
29 }
30}
31
32impl std::error::Error for LogError {}