use std::fmt;
#[cfg(target_os = "windows")]
use winapi::shared::winerror::HRESULT;
pub enum Error {
Other(&'static str),
#[cfg(target_os = "windows")]
Hr(HRESULT),
#[cfg(target_os = "windows")]
D2Error,
#[cfg(target_os = "windows")]
OldWindows,
}
impl fmt::Debug for Error {
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
match *self {
Error::Other(s) => write!(f, "{}", s),
#[cfg(target_os = "windows")]
Error::Hr(hr) => write!(f, "HRESULT 0x{:x}", hr),
#[cfg(target_os = "windows")]
Error::D2Error => write!(f, "Direct2D error"),
#[cfg(target_os = "windows")]
Error::OldWindows => write!(f, "Attempted newer API on older Windows"),
}
}
}