Skip to main content

Module panic

Module panic 

Source
Available on crate feature panic and non-target_family=wasm only.
Expand description

Panic utilities.

StructsΒ§

CaughtPanic
A panic recovered by catch_unwind_with_details, bundling the panic message with the location and backtrace captured at the panic site.
PanicDetails πŸ”’
Details about a caught panic, recorded at the panic site by the enhanced panic handler and consumed by catch_unwind_with_details. Internal: the public-facing type is CaughtPanic.

ConstantsΒ§

CAPTURE_PANIC_DETAILS πŸ”’
Keeps track of how many catch_unwind_with_details calls we are inside.
CATCHING_UNWIND πŸ”’
Keeps track of how many catch_unwind calls we are inside.
CAUGHT_PANIC_DETAILS πŸ”’
Details about the most recently caught panic, recorded by the enhanced panic handler when CAPTURE_PANIC_DETAILS is non-zero. Consumed by catch_unwind_with_details.

StaticsΒ§

CATCHING_UNWIND_ASYNC πŸ”’

FunctionsΒ§

catch_unwind
Like std::panic::catch_unwind, but can unwind panics even if install_enhanced_handler has been called.
catch_unwind_str
Like crate::panic::catch_unwind, but downcasts the returned Box<dyn Any> error to a string which is almost always is.
catch_unwind_with_details
Like catch_unwind_str, but on panic also recovers the panic’s source location and a backtrace captured at the panic site, bundled together in a CaughtPanic.
downcast_panic_message πŸ”’
Downcasts an opaque panic payload (as returned by catch_unwind) to its message string, which it almost always is.
install_enhanced_handler
Overwrites the default panic handler with an enhanced panic handler.