Skip to main content

windows_eventlog_native/
error.rs

1use thiserror::Error;
2
3#[derive(Error, Debug)]
4pub enum Error {
5    #[error("Win32 error: {code:#010x} ({context})")]
6    Win32 { code: u32, context: &'static str },
7
8    #[error("XML parse error: {0}")]
9    Xml(String),
10
11    #[error("invalid UTF-16 in rendered event")]
12    Utf16,
13
14    #[error("unsupported platform (only cfg(windows) is implemented)")]
15    UnsupportedPlatform,
16
17    #[error("channel {0:?} inaccessible: {1}")]
18    ChannelAccess(String, String),
19
20    #[error("timestamp conversion failed: FILETIME={0}")]
21    BadFileTime(u64),
22
23    #[error("other: {0}")]
24    Other(String),
25}
26
27impl From<quick_xml::Error> for Error {
28    fn from(e: quick_xml::Error) -> Self {
29        Error::Xml(e.to_string())
30    }
31}
32
33pub type Result<T> = std::result::Result<T, Error>;