Crate maybe_unwind

Source
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§

Traits§

  • An extension trait for Futures that provides an adaptor for capturing the unwinding panic information.

Functions§