win_desktop_utils/error.rs
1/// Error type for `win-desktop-utils`.
2#[derive(Debug)]
3pub enum Error {
4 /// The requested operation is not implemented on the current platform or in the current crate version.
5 Unsupported(&'static str),
6 /// The caller supplied invalid input.
7 InvalidInput(&'static str),
8 /// An underlying I/O operation failed.
9 Io(std::io::Error),
10 /// A Windows API call failed.
11 WindowsApi {
12 /// Short label describing the failing API call.
13 context: &'static str,
14 /// Raw Windows error or return code when available.
15 code: i32,
16 },
17}
18
19/// Convenient result alias for this crate.
20pub type Result<T> = std::result::Result<T, Error>;
21
22impl From<std::io::Error> for Error {
23 fn from(value: std::io::Error) -> Self {
24 Self::Io(value)
25 }
26}