Expand description
A wrapper of catch_unwind
that also captures the panic information.
The main purpose of this library is to provide a utility for capturing the error information from assetion macros in custom test libraries.
§Example
use maybe_unwind::maybe_unwind;
std::panic::set_hook(Box::new(|info| {
maybe_unwind::capture_panic_info(info);
}));
if let Err(unwind) = maybe_unwind(|| do_something()) {
eprintln!("payload = {:?}", unwind.payload());
eprintln!("location = {:?}", unwind.location());
}
!
Structs§
- The information about the location of an unwinding panic.
- A future for the
maybe_unwind
method. - The captured information about an unwinding panic.
Traits§
- An extension trait for
Future
s that provides an adaptor for capturing the unwinding panic information.
Functions§
- Capture the panic information.
- Invokes a closure, capturing the cause of an unwinding panic if one occurs.