Created
July 4, 2015 08:39
-
-
Save yorkie/dda2d909c6e53a87c971 to your computer and use it in GitHub Desktop.
v8_try macros for rust
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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