arcdps/
panic.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
//! Panic handling.

use crate::exports::log_to_file;
use std::panic;

/// Sets up the custom panic hook.
// TODO: rust will abort when reaching the ffi boundary, which skips arcs crash log
pub fn init_panic_hook(name: &'static str) {
    panic::set_hook(Box::new(move |info| {
        // log the error to the arc log
        let _ = log_to_file(format!("error: {name} {info}"));
    }));
}