Last active: a year ago
Webassembly errors
use std::fmt::Display;
use thiserror::Error;
use wasm_bindgen::JsValue;
#[derive(Error, Debug)]
pub enum Error {
#[error("js runtime error")]
JsError(JsValue),
#[error(transparent)]
Other(#[from] anyhow::Error), // source and Display delegate to anyhow::Error
}
pub fn into_js_value<E>(err: E) -> String
where
E: Display,
{
err.to_string()
}
pub type Result<T, E = Error> = anyhow::Result<T, E>;