Only print backtrace if frames are detected

This commit is contained in:
losfair 2019-07-01 21:12:19 +08:00
parent 614b3b9918
commit adada7e751

View File

@ -230,13 +230,16 @@ extern "C" fn signal_trap_handler(
unwind_result = Box::new(image); unwind_result = Box::new(image);
} else { } else {
use colored::*; use colored::*;
eprintln!( if es_image.frames.len() > 0 {
"\n{}", eprintln!(
"Wasmer encountered an error while running your WebAssembly program." "\n{}",
.bold() "Wasmer encountered an error while running your WebAssembly program."
.red() .bold()
); .red()
es_image.print_backtrace_if_needed(); );
es_image.print_backtrace_if_needed();
}
// Just let the error propagate otherrwise
} }
true true