Fixed errors and warnings

This commit is contained in:
Syrus Akbary
2021-07-14 22:17:35 -07:00
parent a2bae128f1
commit 7195a9c3f0
3 changed files with 3 additions and 5 deletions

View File

@ -11,7 +11,6 @@ edition = "2018"
proc-macro = true
[features]
default-features = []
# It will make imports from `wasmer_js::` instead of `wasmer::`
js = []

View File

@ -462,8 +462,7 @@ impl Function {
arr.set(i as u32, js_value);
}
let result =
js_sys::Reflect::apply(&self.exported.function, &wasm_bindgen::JsValue::NULL, &arr)
.unwrap();
js_sys::Reflect::apply(&self.exported.function, &wasm_bindgen::JsValue::NULL, &arr)?;
let result_types = self.exported.ty.results();
match result_types.len() {

View File

@ -63,7 +63,7 @@ impl RuntimeError {
}
/// Creates a new user `RuntimeError` with the given `error`.
pub fn user(error: impl Error + 'static) -> Self {
pub fn user(error: impl Error + Send + Sync + 'static) -> Self {
RuntimeError {
inner: Arc::new(RuntimeErrorSource::User(Box::new(error))),
}
@ -160,7 +160,7 @@ impl From<JsValue> for RuntimeError {
// We try to downcast the error and see if it's
// an instance of RuntimeError instead, so we don't need
// to re-wrap it.
generic_of_jsval(original, "RuntimeError").unwrap_or_else(|js| RuntimeError {
generic_of_jsval(original, "WasmerRuntimeError").unwrap_or_else(|js| RuntimeError {
inner: Arc::new(RuntimeErrorSource::Js(js)),
})
}