Use gui panic hook
This commit is contained in:
parent
40dc9ae8c0
commit
8c0c23e688
@ -5,7 +5,7 @@ use std::{
|
||||
process, thread, time,
|
||||
};
|
||||
|
||||
use lianad::{config::Config, DaemonHandle, VERSION};
|
||||
use lianad::{config::Config, setup_panic_hook, DaemonHandle, VERSION};
|
||||
|
||||
fn print_help_exit(code: i32) {
|
||||
eprintln!("lianad version {}", VERSION);
|
||||
@ -80,6 +80,8 @@ fn main() {
|
||||
process::exit(1);
|
||||
});
|
||||
|
||||
setup_panic_hook();
|
||||
|
||||
let handle = DaemonHandle::start_default(config, cfg!(unix)).unwrap_or_else(|e| {
|
||||
log::error!("Error starting Liana daemon: {}", e);
|
||||
process::exit(1);
|
||||
|
||||
@ -40,7 +40,7 @@ use miniscript::bitcoin::{constants::ChainHash, hashes::Hash, secp256k1, BlockHa
|
||||
use std::panic;
|
||||
// A panic in any thread should stop the main thread, and print the panic.
|
||||
#[cfg(not(test))]
|
||||
fn setup_panic_hook() {
|
||||
pub fn setup_panic_hook() {
|
||||
panic::set_hook(Box::new(move |panic_info| {
|
||||
let file = panic_info
|
||||
.location()
|
||||
@ -396,9 +396,6 @@ impl DaemonHandle {
|
||||
db: Option<impl DatabaseInterface + 'static>,
|
||||
with_rpc_server: bool,
|
||||
) -> Result<Self, StartupError> {
|
||||
#[cfg(not(test))]
|
||||
setup_panic_hook();
|
||||
|
||||
let secp = secp256k1::Secp256k1::verification_only();
|
||||
|
||||
// First, check the data directory
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user