1#[derive(Debug, PartialEq, thiserror::Error)]
5pub enum IsleError {
6 #[error("isle shut down")]
8 Shutdown,
9
10 #[error("cancelled")]
12 Cancelled,
13
14 #[error("lua error: {0}")]
16 Lua(String),
17
18 #[error("lua thread panicked")]
20 ThreadPanic,
21
22 #[error("send failed (isle shut down)")]
24 SendFailed,
25
26 #[error("recv failed: {0}")]
28 RecvFailed(String),
29
30 #[error("init error: {0}")]
32 Init(String),
33}
34
35impl From<mlua::Error> for IsleError {
36 fn from(e: mlua::Error) -> Self {
37 let msg = e.to_string();
38 if msg.contains("__isle_cancelled__") {
39 Self::Cancelled
40 } else {
41 Self::Lua(msg)
42 }
43 }
44}