Skip to main content

catch_unwind_str

Function catch_unwind_str 

Source
pub fn catch_unwind_str<F, R>(f: F) -> Result<R, Cow<'static, str>>
where F: FnOnce() -> R + UnwindSafe,
Available on non-target_family=wasm and crate feature panic only.
Expand description

Like crate::panic::catch_unwind, but downcasts the returned Box<dyn Any> error to a string which is almost always is.

See: https://doc.rust-lang.org/stable/std/panic/struct.PanicHookInfo.html#method.payload