fiberplane-pdk 1.0.0-beta.14

Fiberplane Provider Development Kit
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
//! This module provides a helper function that
//! sets up the panic handler so that unrecoverable
//! errors from the provider show better messages.

use fiberplane_provider_bindings::log;
use std::panic;

pub fn init_panic_hook() {
    use std::sync::Once;
    static SET_HOOK: Once = Once::new();
    SET_HOOK.call_once(|| {
        panic::set_hook(Box::new(|info| log(format!("Provider panic: {info}"))));
    });
}