Fix error message and shorten code

This commit is contained in:
Jonas Schievink 2017-08-01 23:42:42 +02:00
parent ed6e7ed5e7
commit cb61d53ba5
1 changed files with 5 additions and 4 deletions

View File

@ -385,11 +385,12 @@ pub unsafe fn pcall_with_traceback(
ffi::lua_remove(state, -2); ffi::lua_remove(state, -2);
} else if !is_wrapped_panic(state, 1) { } else if !is_wrapped_panic(state, 1) {
let s = ffi::lua_tolstring(state, 1, ptr::null_mut()); let s = ffi::lua_tolstring(state, 1, ptr::null_mut());
if !s.is_null() { let s = if s.is_null() {
ffi::luaL_traceback(state, state, s, 0); cstr!("<unprintable Rust panic>")
} else { } else {
ffi::luaL_traceback(state, state, cstr!("<unprintable lua error>"), 0); s
} };
ffi::luaL_traceback(state, state, s, 0);
ffi::lua_remove(state, -2); ffi::lua_remove(state, -2);
} }
1 1