1
Fork 0

Debug-print error when using rtunwrap

This commit is contained in:
Jethro Beekman 2019-04-23 10:06:27 -07:00
parent fe0a415b4b
commit 942831eef4

View file

@ -30,10 +30,12 @@ macro_rules! rtassert {
#[allow(unused_macros)] // not used on all platforms
macro_rules! rtunwrap {
($ok:ident, $e:expr) => (if let $ok(v) = $e {
v
} else {
rtabort!(concat!("unwrap failed: ", stringify!($e)));
($ok:ident, $e:expr) => (match $e {
$ok(v) => v,
ref err => {
let err = err.as_ref().map(|_|()); // map Ok/Some which might not be Debug
rtabort!(concat!("unwrap failed: ", stringify!($e), " = {:?}"), err)
},
})
}