[][src]Crate maybe_unwind

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

Location

The information about the location of an unwinding panic.

MaybeUnwind

A future for the maybe_unwind method.

Unwind

The captured information about an unwinding panic.

Traits

FutureMaybeUnwindExt

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

Functions

capture_panic_info

Capture the panic information.

maybe_unwind

Invokes a closure, capturing the cause of an unwinding panic if one occurs.