From 4406fbb6f3cd8f737899a17173c7ac954df264cf Mon Sep 17 00:00:00 2001 From: Patrick Ventuzelo Date: Mon, 2 Sep 2019 12:12:35 +0200 Subject: [PATCH 1/3] replace panics with return Err() --- src/bin/wasmer.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bin/wasmer.rs b/src/bin/wasmer.rs index 06ca175000f..4f77ec68ec4 100644 --- a/src/bin/wasmer.rs +++ b/src/bin/wasmer.rs @@ -634,7 +634,7 @@ fn execute_wasm(options: &Run) -> Result<(), String> { if let Err(ref err) = result { match err { - RuntimeError::Trap { msg } => panic!("wasm trap occured: {}", msg), + RuntimeError::Trap { msg } => return Err(format!("wasm trap occured: {}", msg)), #[cfg(feature = "wasi")] RuntimeError::Error { data } => { if let Some(error_code) = data.downcast_ref::() { @@ -644,7 +644,7 @@ fn execute_wasm(options: &Run) -> Result<(), String> { #[cfg(not(feature = "wasi"))] RuntimeError::Error { .. } => (), } - panic!("error: {:?}", err) + return Err(format!("error: {:?}", err)) } } } else { From cdba7e55e516c2bc4601b9478aa27003c03b75c2 Mon Sep 17 00:00:00 2001 From: Patrick Ventuzelo <9038181+pventuzelo@users.noreply.github.com> Date: Tue, 3 Sep 2019 17:06:37 +0200 Subject: [PATCH 2/3] Update src/bin/wasmer.rs Co-Authored-By: Syrus Akbary --- src/bin/wasmer.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bin/wasmer.rs b/src/bin/wasmer.rs index 4f77ec68ec4..5d0f849c369 100644 --- a/src/bin/wasmer.rs +++ b/src/bin/wasmer.rs @@ -644,7 +644,7 @@ fn execute_wasm(options: &Run) -> Result<(), String> { #[cfg(not(feature = "wasi"))] RuntimeError::Error { .. } => (), } - return Err(format!("error: {:?}", err)) + return Err(format!("error: {:?}", err)); } } } else { From 7dd496c4909b7bf7d0f357bca28d5f256b6e9a64 Mon Sep 17 00:00:00 2001 From: Patrick Ventuzelo <9038181+pventuzelo@users.noreply.github.com> Date: Tue, 3 Sep 2019 17:06:56 +0200 Subject: [PATCH 3/3] Update src/bin/wasmer.rs Co-Authored-By: Syrus Akbary --- src/bin/wasmer.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/bin/wasmer.rs b/src/bin/wasmer.rs index 5d0f849c369..651981b3bbe 100644 --- a/src/bin/wasmer.rs +++ b/src/bin/wasmer.rs @@ -634,7 +634,9 @@ fn execute_wasm(options: &Run) -> Result<(), String> { if let Err(ref err) = result { match err { - RuntimeError::Trap { msg } => return Err(format!("wasm trap occured: {}", msg)), + RuntimeError::Trap { msg } => { + return Err(format!("wasm trap occured: {}", msg)) + } #[cfg(feature = "wasi")] RuntimeError::Error { data } => { if let Some(error_code) = data.downcast_ref::() {