diff --git a/src/util.rs b/src/util.rs index e91b955..d1a4a58 100644 --- a/src/util.rs +++ b/src/util.rs @@ -288,10 +288,11 @@ pub unsafe fn handle_error(state: *mut ffi::lua_State, err: c_int) -> Result<()> } } ffi::LUA_ERRERR => { - // This can only happen when rlua's own message handler raises an error, which - // should never happen unless there's a bug. This would also be dangerous as it - // longjmps over Rust frames. - lua_panic!(state, "message handler raised error: {}", err_string); + // The Lua manual documents this error wrongly: It is not raised when a message + // handler errors, but rather when some specific situations regarding stack + // overflow handling occurs. Since it is not very useful do differentiate + // between that and "ordinary" runtime errors, we handle them the same way. + Error::RuntimeError(err_string) } ffi::LUA_ERRMEM => { // This is not impossible to hit, but this library is not set up