From adada7e751e2970e24b96ee861af8cf4a226af07 Mon Sep 17 00:00:00 2001 From: losfair Date: Mon, 1 Jul 2019 21:12:19 +0800 Subject: [PATCH] Only print backtrace if frames are detected --- lib/runtime-core/src/alternative_stack.rs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/lib/runtime-core/src/alternative_stack.rs b/lib/runtime-core/src/alternative_stack.rs index 102cc4abd..248ad1c79 100644 --- a/lib/runtime-core/src/alternative_stack.rs +++ b/lib/runtime-core/src/alternative_stack.rs @@ -230,13 +230,16 @@ extern "C" fn signal_trap_handler( unwind_result = Box::new(image); } else { use colored::*; - eprintln!( - "\n{}", - "Wasmer encountered an error while running your WebAssembly program." - .bold() - .red() - ); - es_image.print_backtrace_if_needed(); + if es_image.frames.len() > 0 { + eprintln!( + "\n{}", + "Wasmer encountered an error while running your WebAssembly program." + .bold() + .red() + ); + es_image.print_backtrace_if_needed(); + } + // Just let the error propagate otherrwise } true