Skip to content

Commit

Permalink
Return String instead of Result<String, JsValue>
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaslihotzki committed Sep 24, 2022
1 parent fc615e6 commit 74bec76
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
5 changes: 1 addition & 4 deletions crates/backend/src/codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,7 @@ impl TryToTokens for ast::LinkToModule {
#extern_fn

unsafe {
let _ret = #name();
wasm_bindgen::__rt::take_last_exception().map(|()| {
<String as wasm_bindgen::convert::FromWasmAbi>::from_abi(_ret)
})
<String as wasm_bindgen::convert::FromWasmAbi>::from_abi(#name())
}
}
})
Expand Down
2 changes: 1 addition & 1 deletion crates/futures/src/task/wait_async_polyfill.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ fn alloc_helper() -> Worker {
return helper;
}

let worker_url = wasm_bindgen::link_to!(module = "/src/task/worker.js").unwrap();
let worker_url = wasm_bindgen::link_to!(module = "/src/task/worker.js");
Worker::new(&worker_url).unwrap_or_else(|js| wasm_bindgen::throw_val(js))
})
}
Expand Down
2 changes: 1 addition & 1 deletion crates/macro/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub fn link_to(input: TokenStream) -> TokenStream {
}
tokens.into()
}
Err(diagnostic) => (quote! { Result::<String, JsValue>::Ok(#diagnostic) }).into(),
Err(diagnostic) => (quote! { String::clone(#diagnostic) }).into(),
}
}

Expand Down

0 comments on commit 74bec76

Please sign in to comment.