Skip to content

Commit

Permalink
Merge #690
Browse files Browse the repository at this point in the history
690: Convert panic to error when calling emscripten main r=bjfish a=bjfish

Fixes #685 

Co-authored-by: Brandon Fish <brandon.j.fish@gmail.com>
  • Loading branch information
bors[bot] and bjfish authored Aug 17, 2019
2 parents 2ebe93c + d899909 commit 0a3182e
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions lib/emscripten/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use std::collections::HashMap;
use std::path::PathBuf;
use std::{f64, ffi::c_void};
use wasmer_runtime_core::{
error::CallResult,
error::{CallError, CallResult, ResolveError},
export::Export,
func,
global::Global,
Expand Down Expand Up @@ -373,10 +373,11 @@ pub fn run_emscripten_instance(
0 => {
instance.call(func_name, &[])?;
}
_ => panic!(
"The emscripten main function has received an incorrect number of params {}",
num_params
),
_ => {
return Err(CallError::Resolve(ResolveError::ExportWrongType {
name: "main".to_string(),
}))
}
};
}

Expand Down

0 comments on commit 0a3182e

Please sign in to comment.