Skip to main content

panic_message

Function panic_message 

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

Extracts a human-readable message from a catch_unwind payload.

This only borrows the payload; when you are done with it, dispose of it with drop_panic_payload (or use take_panic_message, which does both) — a payload’s own Drop may panic, and at an FFI boundary that aborts.

§Example

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