Skip to content

Instantly share code, notes, and snippets.

@yorkie
Created July 4, 2015 08:39
Show Gist options
  • Save yorkie/dda2d909c6e53a87c971 to your computer and use it in GitHub Desktop.
Save yorkie/dda2d909c6e53a87c971 to your computer and use it in GitHub Desktop.
v8_try macros for rust
macro_rules! v8_try {
($expr:expr, $args:ident) => ({
let ret;
match $expr {
Ok(val) => {
ret = Some(val);
},
Err(err) => {
ret = None;
$args.GetReturnValue().SetWithBool(false)
}
};
ret.unwrap()
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment