Fix handling of CallbackError

Previously, the traceback would be printed, but not the actual error.

I've removed traceback printing completely, not sure if that's a good
idea. A `Display` impl that outputs multiple lines feels weird.
This commit is contained in:
Jonas Schievink
2017-08-01 19:46:05 +02:00
parent 7e250dacce
commit ed0565c176
3 changed files with 18 additions and 9 deletions
+8 -2
View File
@@ -380,7 +380,10 @@ pub unsafe fn pcall_with_traceback(
.to_str()
.unwrap_or_else(|_| "<could not capture traceback>")
.to_owned();
push_wrapped_error(state, Error::CallbackError(traceback, Arc::new(error)));
push_wrapped_error(state, Error::CallbackError {
traceback,
cause: Arc::new(error),
});
ffi::lua_remove(state, -2);
} else if !is_wrapped_panic(state, 1) {
let s = ffi::lua_tolstring(state, 1, ptr::null_mut());
@@ -415,7 +418,10 @@ pub unsafe fn resume_with_traceback(
.to_str()
.unwrap_or_else(|_| "<could not capture traceback>")
.to_owned();
push_wrapped_error(state, Error::CallbackError(traceback, Arc::new(error)));
push_wrapped_error(state, Error::CallbackError {
traceback,
cause: Arc::new(error),
});
ffi::lua_remove(state, -2);
} else if !is_wrapped_panic(state, 1) {
let s = ffi::lua_tolstring(state, 1, ptr::null_mut());