mirror of
https://git.um-react.app/um/lib_um_crypto_rust.git
synced 2026-03-07 20:19:51 +00:00
build: fix wasm build
This commit is contained in:
@@ -1,22 +1,8 @@
|
||||
use wasm_bindgen::JsError;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct WasmError {
|
||||
error: anyhow::Error,
|
||||
}
|
||||
|
||||
impl From<anyhow::Error> for WasmError {
|
||||
fn from(err: anyhow::Error) -> WasmError {
|
||||
WasmError { error: err }
|
||||
}
|
||||
}
|
||||
|
||||
impl From<WasmError> for JsError {
|
||||
fn from(error: WasmError) -> Self {
|
||||
JsError::new(&error.error.to_string())
|
||||
}
|
||||
}
|
||||
|
||||
pub fn map_js_error(error: anyhow::Error) -> wasm_bindgen::JsError {
|
||||
JsError::new(&error.to_string())
|
||||
pub fn map_js_error<T>(error: T) -> JsError
|
||||
where
|
||||
T: std::fmt::Debug + std::fmt::Display,
|
||||
{
|
||||
JsError::new(error.to_string().as_str())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user