Files
cdk/bindings/cdk-js/src/error.rs
2024-05-10 11:27:32 +01:00

13 lines
288 B
Rust

use wasm_bindgen::JsValue;
pub type Result<T, E = JsValue> = std::result::Result<T, E>;
/// Helper to replace the `E` to `Error` to `napi::Error` conversion.
#[inline]
pub fn into_err<E>(error: E) -> JsValue
where
E: std::fmt::Display,
{
JsValue::from_str(&error.to_string())
}