Trait rquickjs_core::CatchResultExt
source · pub trait CatchResultExt<'js, T> {
// Required method
fn catch(self, ctx: &Ctx<'js>) -> CaughtResult<'js, T>;
}
Expand description
Extension trait to easily turn results with Error
into results with CaughtError
§Usage
use rquickjs::CatchResultExt;
if let Err(CaughtError::Value(err)) = ctx.eval::<(),_>("throw 3").catch(&ctx){
assert_eq!(err.as_int(),Some(3));
}