1#[derive(Debug)]
2pub enum Error {
3 Lua(rlua::Error),
4}
5
6impl From<rlua::Error> for Error {
7 fn from(error: rlua::Error) -> Self {
8 Error::Lua(error)
9 }
10}
11
12impl From<Error> for rlua::Error {
13 fn from(error: Error) -> Self {
14 rlua::Error::RuntimeError(format!("rlua-searcher error: {}", error))
15 }
16}
17
18impl std::fmt::Display for Error {
19 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
20 let res = match self {
21 Error::Lua(e) => format!("rlua error:\n{:#?}", e),
22 };
23 write!(f, "{}", res)
24 }
25}
26
27impl std::error::Error for Error {}