Files
Prajjwal Kumar 9b618d2447 feat(router): Add Smart Routing to route payments efficiently (#2665)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: shashank_attarde <shashank.attarde@juspay.in>
Co-authored-by: Aprabhat19 <amishaprabhat@gmail.com>
Co-authored-by: Amisha Prabhat <55580080+Aprabhat19@users.noreply.github.com>
2023-11-03 13:07:31 +00:00

18 lines
359 B
Rust

use wasm_bindgen::prelude::*;
pub trait JsResultExt<T> {
fn err_to_js(self) -> Result<T, JsValue>;
}
impl<T, E> JsResultExt<T> for Result<T, E>
where
E: serde::Serialize,
{
fn err_to_js(self) -> Result<T, JsValue> {
match self {
Ok(t) => Ok(t),
Err(e) => Err(serde_wasm_bindgen::to_value(&e)?),
}
}
}