Handle LUA_ERRERR

This commit is contained in:
Jonas Schievink 2017-08-02 21:41:35 +02:00
parent 70f05ac068
commit dd1d335cee
1 changed files with 5 additions and 4 deletions

View File

@ -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