safex11/src/errors.rs
2023-08-20 05:10:03 -05:00

40 lines
868 B
Rust

pub type Result<T, E = Error> = std::result::Result<T, E>;
/// Any error that can be raised when using this library.
#[allow(missing_docs)]
#[derive(Debug, Error)]
pub enum Error {
#[error("invalid image byte order: {0}")]
InvalidByteOrder(i32),
#[error("invalid event type: {0}")]
InvalidEventType(i32),
#[error("failed to get attributes")]
GetAttributesError,
#[error("failed to create cursor")]
CreateCursorError,
#[error("failed to open display")]
DisplayOpenError,
#[error("failed to get window")]
GetWindowError,
#[error("failed to translate coordinates")]
TranslateCoordinatesError,
#[error("utf8 decoding error: {0}")]
Utf8(#[from] std::str::Utf8Error),
#[error("nul error: {0}")]
Nul(#[from] std::ffi::NulError),
#[error("env var error: {0}")]
Var(#[from] std::env::VarError),
#[error("error")]
Error,
}