Skip to content

Commit

Permalink
Merge pull request #747 from pventuzelo/pventuzelo/724-fix-panics-exe…
Browse files Browse the repository at this point in the history
…cute-wasm

[fix issue #724] replace panic! with return Err()
  • Loading branch information
syrusakbary authored Sep 3, 2019
2 parents 777833e + 7dd496c commit 80c1359
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/bin/wasmer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,9 @@ 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::<wasmer_wasi::ExitCode>() {
Expand All @@ -644,7 +646,7 @@ fn execute_wasm(options: &Run) -> Result<(), String> {
#[cfg(not(feature = "wasi"))]
RuntimeError::Error { .. } => (),
}
panic!("error: {:?}", err)
return Err(format!("error: {:?}", err));
}
}
} else {
Expand Down

0 comments on commit 80c1359

Please sign in to comment.