Skip to main content

take_panic_message

Function take_panic_message 

Source
pub fn take_panic_message(payload: Box<dyn Any + Send>) -> String
Expand description

Extracts the panic message from a caught payload, then disposes of the payload with drop_panic_payload.

The message is copied out first, so it survives even when the payload’s Drop panics. Used by every callback macro in this crate; public because the macros expand in the extension crate and need to reach it.

§Example

let payload = std::panic::catch_unwind(|| panic!("boom")).unwrap_err();
assert_eq!(quack_rs::callback::take_panic_message(payload), "boom");