macro_rules! attach_context {
($error:expr) => { ... };
}Expand description
Append the current source location to the backtrace of an Err result,
and pass an Ok through.
§Arguments
result- The result to attach the context to.
§Returns
The result, with the location appended to an error’s backtrace.
§Examples
use tvm_ffi::{attach_context, bail, Result, RUNTIME_ERROR};
fn inner() -> Result<()> {
bail!(RUNTIME_ERROR, "failed");
}
fn outer() -> Result<()> {
attach_context!(inner())
}
assert!(outer().unwrap_err().backtrace().contains("outer"));