diff --git a/CHANGELOG.md b/CHANGELOG.md index 29014cb9a..04cf0ae32 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## **[Unreleased]** +- [#858](https://github.com/wasmerio/wasmer/pull/858) Minor panic fix when wasmer binary with `loader` option run a module without exported `_start` function. - [#1056](https://github.com/wasmerio/wasmer/pull/1056) Improved `--invoke` args parsing (supporting `i32`, `i64`, `f32` and `f32`) in Wasmer CLI - [#1054](https://github.com/wasmerio/wasmer/pull/1054) Improve `--invoke` output in Wasmer CLI - [#1053](https://github.com/wasmerio/wasmer/pull/1053) For RuntimeError and breakpoints, use Box instead of Box. diff --git a/src/bin/wasmer.rs b/src/bin/wasmer.rs index 5c8c7cdd6..bb0377fc0 100644 --- a/src/bin/wasmer.rs +++ b/src/bin/wasmer.rs @@ -430,7 +430,7 @@ fn execute_wasi( f.read_to_end(&mut out).unwrap(); Some( wasmer_runtime_core::state::InstanceImage::from_bytes(&out) - .expect("failed to decode image"), + .map_err(|_| format!("failed to decode image"))?, ) } else { None @@ -751,20 +751,21 @@ fn execute_wasm(options: &Run) -> Result<(), String> { args.push(Value::I32(x)); } - let index = instance - .resolve_func("_start") - .expect("The loader requires a _start function to be present in the module"); + let index = instance.resolve_func("_start").map_err(|_| { + format!("The loader requires a _start function to be present in the module") + })?; + let mut ins: Box> = match loader { LoaderName::Local => Box::new( instance .load(LocalLoader) - .expect("Can't use the local loader"), + .map_err(|e| format!("Can't use the local loader: {:?}", e))?, ), #[cfg(feature = "loader-kernel")] LoaderName::Kernel => Box::new( instance .load(::wasmer_kernel_loader::KernelLoader) - .expect("Can't use the kernel loader"), + .map_err(|e| format!("Can't use the local loader: {:?}", e))?, ), }; println!("{:?}", ins.call(index, &args));