Skip to main content

guard_infallible

Function guard_infallible 

Source
pub fn guard_infallible<T>(thunk_name: &str, f: impl FnOnce() -> T) -> T
Expand description

Runs a closure under catch_unwind for thunks whose return type cannot carry a PluginError (e.g. extern "C" fn(...) -> u64).

On panic, logs the message and aborts the process. Aborting is the only sound option once a panic reaches this point: returning a sentinel would silently corrupt downstream computation, and unwinding across the FFI boundary is undefined behaviour.