Convert panic to error when calling emscripten main

This commit is contained in:
Brandon Fish
2019-08-16 22:18:13 -06:00
parent 2ebe93cc72
commit d89990951e

View File

@ -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,
@ -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(),
}))
}
};
}