#[derive(Debug)]
pub enum Error {
Lua(rlua::Error),
}
impl From<rlua::Error> for Error {
fn from(error: rlua::Error) -> Self {
Error::Lua(error)
}
}
impl From<Error> for rlua::Error {
fn from(error: Error) -> Self {
rlua::Error::RuntimeError(format!("rlua-searcher error: {}", error))
}
}
impl std::fmt::Display for Error {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let res = match self {
Error::Lua(e) => format!("rlua error:\n{:#?}", e),
};
write!(f, "{}", res)
}
}
impl std::error::Error for Error {}