Skip to main content

set_panic_telemetry_hook

Function set_panic_telemetry_hook 

Source
pub fn set_panic_telemetry_hook(f: impl Fn(&PanicReport<'_>) + 'static)
Expand description

Register a panic telemetry hook on R’s main thread.

The hook is called with a PanicReport each time a Rust panic is about to be converted into an R error. Only one hook can be active at a time; calling this again replaces (and drops) the previous hook.

Call it on R’s main thread, where every panic→R-error boundary runs (see Threads). It is safe to call set_panic_telemetry_hook or clear_panic_telemetry_hook from within a hook: the slot is not borrowed while the hook runs.