Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
node: register panic handler
✗ CI failure Fintan Halpenny committed 10 months ago
commit f8175013e6a3315d6a550ed4715abc6ce39b93af
parent df4eff4c131d8bfe7defa3c733eeedcd493ede57
1 failed 1 pending (2 total) View logs
1 file changed +19 -0
modified crates/radicle-node/src/main.rs
@@ -132,6 +132,7 @@ fn execute() -> anyhow::Result<()> {

fn main() {
    std::env::set_var("RUST_BACKTRACE", "1");
+
    panic_handler();
    if let Err(err) = execute() {
        if log::log_enabled!(target: "node", log::Level::Error) {
            log::error!(target: "node", "Fatal: {err:#}");
@@ -141,3 +142,21 @@ fn main() {
        process::exit(1);
    }
}
+

+
fn panic_handler() {
+
    let prev = std::panic::take_hook();
+
    std::panic::set_hook(Box::new(move |info| {
+
        let err = r#"
+
radicle-node: fatal error
+

+
👾 Something went wrong!
+

+
This is almost certainly a bug, and we'd appreciate a report so we can improve Radicle.
+

+
Please report this error with `rad issue open --repo rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5`,
+
or on https://radicle.zulipchat.com/#narrow/channel/369873-support.
+
"#;
+
        eprintln!("\n{err}");
+
        prev(info);
+
    }));
+
}