1use thiserror::Error;
2
3pub type Result<T> = std::result::Result<T, Error>;
4
5#[derive(Debug, Error)]
6pub enum Error {
7 #[error("CoInitializeEx failed: HRESULT 0x{0:08x}")]
8 CoInit(i32),
9
10 #[error("{context}: HRESULT 0x{hr:08x}")]
11 Hr { context: &'static str, hr: i32 },
12
13 #[error("windows: {0}")]
14 Windows(#[from] windows_core::Error),
15
16 #[error("field {0:?} missing")]
17 MissingField(String),
18
19 #[error("field {name:?}: expected {expected}, got {got}")]
20 TypeMismatch {
21 name: String,
22 expected: &'static str,
23 got: &'static str,
24 },
25}