arcdps/
panic.rs

1//! Panic handling.
2
3use crate::exports::log_to_file;
4use std::panic;
5
6/// Sets up the custom panic hook.
7// TODO: rust will abort when reaching the ffi boundary, which skips arcs crash log
8pub fn init_panic_hook(name: &'static str) {
9    panic::set_hook(Box::new(move |info| {
10        // log the error to the arc log
11        let _ = log_to_file(format!("error: {name} {info}"));
12    }));
13}