MCPcopy Create free account
hub / github.com/ChainSafe/Delorean-Protocol / init_panic_handler

Function init_panic_handler

fendermint/app/src/main.rs:76–96  ·  view source on GitHub ↗

Install a panic handler that prints stuff to the logs, otherwise it only shows up in the console.

()

Source from the content-addressed store, hash-verified

74
75/// Install a panic handler that prints stuff to the logs, otherwise it only shows up in the console.
76fn init_panic_handler() {
77 let default_hook = std::panic::take_hook();
78
79 std::panic::set_hook(Box::new(move |info| {
80 // Do the default first, just in case logging fails too.
81 default_hook(info);
82
83 // let stacktrace = std::backtrace::Backtrace::capture();
84 let stacktrace = std::backtrace::Backtrace::force_capture();
85
86 tracing::error!(
87 stacktrace = stacktrace.to_string(),
88 info = info.to_string(),
89 "panicking"
90 );
91
92 // We could exit the application if any of the background tokio tasks panic.
93 // However, they are not necessarily critical processes, the chain might still make progress.
94 // std::process::abort();
95 }))
96}
97
98#[tokio::main]
99async fn main() {

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected