use thiserror::Error as ThisError;
pub type QueueResult<T> = Result<T, Error>;
#[derive(ThisError, Debug)]
pub enum Error {
#[error("an IO error occurred: {source}")]
IOError {
source: std::io::Error,
},
#[error("the item queue is empty")]
QueueEmpty,
#[error("unable to communicate with the global queue")]
SendError,
#[error("there is no running global queue")]
NoGlobalQueue,
#[error("the Lua userscript environment does not appear to be running")]
NoLuaVm,
}
impl Error {
#[must_use]
pub fn empty() -> Self {
Self::QueueEmpty
}
}
impl From<std::io::Error> for Error {
fn from(source: std::io::Error) -> Self {
Self::IOError { source }
}
}