replace panics with return Err()

This commit is contained in:
Patrick Ventuzelo 2019-09-02 12:12:35 +02:00
parent 8965314529
commit 4406fbb6f3

View File

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