Skip to main content

set_panic_telemetry_hook

Function set_panic_telemetry_hook 

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

Register a panic telemetry hook.

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.

§Thread Safety

The hook may be called from any thread (worker thread, main R thread, etc.). Ensure your closure is safe to call concurrently.

It is safe to call set_panic_telemetry_hook or clear_panic_telemetry_hook from within a hook — the lock is released before the hook is invoked.