Trait iop_keyvault_wasm::MapJsError
source · [−]pub trait MapJsError<T> {
fn map_err_to_js(self) -> Result<T, JsValue>;
}
Expand description
An extension trait on Result
that helps easy conversion of Rust errors to JavaScript
error strings usable by wasm_bindgen
Required Methods
fn map_err_to_js(self) -> Result<T, JsValue>
fn map_err_to_js(self) -> Result<T, JsValue>
An extension method on Result
to easily convert Rust errors to JavaScript ones.
ⓘ
#[wasm_bindgen]
pub fn method(&self) -> Result<JsSomething, JsValue> {
let result: JsSomething = self.fallible().map_err_to_js()?;
Ok(result)
}