mirror of
https://github.com/fluencelabs/wasmer
synced 2025-06-23 05:31:32 +00:00
Convert panic to error when calling emscripten main
This commit is contained in:
@ -16,7 +16,7 @@ use std::collections::HashMap;
|
|||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::{f64, ffi::c_void};
|
use std::{f64, ffi::c_void};
|
||||||
use wasmer_runtime_core::{
|
use wasmer_runtime_core::{
|
||||||
error::CallResult,
|
error::{CallError, CallResult, ResolveError},
|
||||||
export::Export,
|
export::Export,
|
||||||
func,
|
func,
|
||||||
global::Global,
|
global::Global,
|
||||||
@ -373,10 +373,11 @@ pub fn run_emscripten_instance(
|
|||||||
0 => {
|
0 => {
|
||||||
instance.call(func_name, &[])?;
|
instance.call(func_name, &[])?;
|
||||||
}
|
}
|
||||||
_ => panic!(
|
_ => {
|
||||||
"The emscripten main function has received an incorrect number of params {}",
|
return Err(CallError::Resolve(ResolveError::ExportWrongType {
|
||||||
num_params
|
name: "main".to_string(),
|
||||||
),
|
}))
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user