mirror of
				https://github.com/juspay/hyperswitch.git
				synced 2025-10-31 18:17:13 +08:00 
			
		
		
		
	 9b618d2447
			
		
	
	9b618d2447
	
	
	
		
			
			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>
		
			
				
	
	
		
			18 lines
		
	
	
		
			359 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
			
		
		
	
	
			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)?),
 | |
|         }
 | |
|     }
 | |
| }
 |