From dd1d335ceefb934a7d34fb79980bf1a74feea791 Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Wed, 2 Aug 2017 21:41:35 +0200 Subject: [PATCH] Handle LUA_ERRERR --- src/util.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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