Replace println error handling.

Use `panic!` and log macros for error handling instead of `println!`.
This commit is contained in:
Dan Gohman
2019-09-25 22:32:53 -07:00
parent 053fb3433e
commit 7899784663
2 changed files with 8 additions and 8 deletions

View File

@@ -77,7 +77,7 @@ impl AbiRet for () {
fn get_wasi_ctx(vmctx: &mut VMContext) -> Result<&mut WasiCtx, wasm32::__wasi_errno_t> {
unsafe {
vmctx.host_state().downcast_mut::<WasiCtx>().ok_or_else(|| {
println!("!!! no host state named WasiCtx available");
panic!("no host state named WasiCtx available");
wasm32::__WASI_EINVAL
})
}
@@ -95,8 +95,8 @@ fn get_memory(vmctx: &mut VMContext) -> Result<&mut [u8], wasm32::__wasi_errno_t
(*definition).current_length,
)),
x => {
println!(
"!!! no export named \"memory\", or the export isn't a mem: {:?}",
error!(
"no export named \"memory\", or the export isn't a mem: {:?}",
x
);
Err(wasm32::__WASI_EINVAL)