use rayon::ThreadPoolBuildError;
use thiserror::Error;
use crate::config::Config;
#[derive(Error, Debug)]
pub enum Error {
#[error("No known event '{0}'")]
InvalidEvent(u32),
#[error("Event '{event}' falls outside valid range [{min}, {max}]")]
InvalidRangedEvent { event: u32, min: u32, max: u32 },
#[error("Config '{0:?}' is not valid")]
InvalidConfig(Config),
#[error("Failed to install WinEventHook")]
Installation,
#[error("Failed to allocate threadpool")]
Threadpool(#[from] ThreadPoolBuildError),
#[error("Failed to uninstall WinEventHook")]
Uninstallation,
#[error("Failed to terminate eventloop")]
EventLoop(#[from] windows::core::Error),
#[error("Failed to uninstall WinEventHook, already uninstalled")]
AlreadyUninstalled,
}
pub type Result<T> = std::result::Result<T, Error>;