#[derive(Debug)]
pub enum ReactionError {
InvalidConfiguration(String),
RawInputNotAvailable,
RawInputError(String),
PlatformNotSupported,
GamepadNotFound(crate::types::GamepadId),
ConfigLoadError(String),
}
impl std::fmt::Display for ReactionError {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
match self {
Self::InvalidConfiguration(msg) => write!(f, "Configuration error: {msg}"),
Self::RawInputNotAvailable => write!(f, "Raw input provider not available"),
Self::RawInputError(msg) => write!(f, "Raw input failure: {msg}"),
Self::PlatformNotSupported => write!(f, "Reaction does not support this platform yet"),
Self::GamepadNotFound(id) => write!(f, "Gamepad {id:?} is not connected"),
Self::ConfigLoadError(msg) => write!(f, "Failed to load config: {msg}"),
}
}
}
impl std::error::Error for ReactionError {}
pub type Result<T> = std::result::Result<T, ReactionError>;