Merge pull request #747 from pventuzelo/pventuzelo/724-fix-panics-execute-wasm

[fix issue #724] replace panic! with return Err()
This commit is contained in:
Syrus Akbary 2019-09-03 10:42:47 -07:00 committed by GitHub
commit 80c1359c84
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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>() {
@ -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 {