mirror of
https://github.com/fluencelabs/wasmer
synced 2025-04-10 19:36:04 +00:00
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:
commit
80c1359c84
@ -634,7 +634,9 @@ fn execute_wasm(options: &Run) -> Result<(), String> {
|
|||||||
|
|
||||||
if let Err(ref err) = result {
|
if let Err(ref err) = result {
|
||||||
match err {
|
match err {
|
||||||
RuntimeError::Trap { msg } => panic!("wasm trap occured: {}", msg),
|
RuntimeError::Trap { msg } => {
|
||||||
|
return Err(format!("wasm trap occured: {}", msg))
|
||||||
|
}
|
||||||
#[cfg(feature = "wasi")]
|
#[cfg(feature = "wasi")]
|
||||||
RuntimeError::Error { data } => {
|
RuntimeError::Error { data } => {
|
||||||
if let Some(error_code) = data.downcast_ref::<wasmer_wasi::ExitCode>() {
|
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"))]
|
#[cfg(not(feature = "wasi"))]
|
||||||
RuntimeError::Error { .. } => (),
|
RuntimeError::Error { .. } => (),
|
||||||
}
|
}
|
||||||
panic!("error: {:?}", err)
|
return Err(format!("error: {:?}", err));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user