#[derive(Debug, PartialEq, thiserror::Error)]
#[non_exhaustive]
pub enum IsleError {
#[error("isle shut down")]
Shutdown,
#[error("cancelled")]
Cancelled,
#[error("lua error: {0}")]
Lua(String),
#[error("lua thread panicked")]
ThreadPanic,
#[cfg(feature = "tokio")]
#[error("channel full (backpressure)")]
ChannelFull,
#[error("recv failed: {0}")]
RecvFailed(String),
#[error("init error: {0}")]
Init(String),
#[cfg(feature = "pool")]
#[error("pool exhausted (max_size={0})")]
PoolExhausted(usize),
#[cfg(feature = "pool")]
#[error("pool lock poisoned: {0}")]
PoolPoisoned(String),
}
impl From<mlua::Error> for IsleError {
fn from(e: mlua::Error) -> Self {
let msg = e.to_string();
if msg.contains("__isle_cancelled__") {
Self::Cancelled
} else {
Self::Lua(msg)
}
}
}