Add error to JsValue conversion and example (#691)
This commit is contained in:
committed by
Sean McArthur
parent
57300edbc4
commit
43f2ff083c
14
src/error.rs
14
src/error.rs
@@ -170,6 +170,20 @@ impl StdError for Error {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
impl From<crate::error::Error> for wasm_bindgen::JsValue {
|
||||
fn from(err: Error) -> wasm_bindgen::JsValue {
|
||||
js_sys::Error::from(err).into()
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
impl From<crate::error::Error> for js_sys::Error {
|
||||
fn from(err: Error) -> js_sys::Error {
|
||||
js_sys::Error::new(&format!("{}", err))
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub(crate) enum Kind {
|
||||
Builder,
|
||||
|
||||
Reference in New Issue
Block a user