mirror of
https://github.com/rustic-rs/rustic.git
synced 2025-10-26 11:18:51 +00:00
feat(ux): Use human-panic to print better error messages in case rustic panics (#1065)
human-panic is in so far valuable, that it can help us to better diagnose panics and errors in rustic as it prints better messages and even writes a log file with the stacktrace, that users can attach to their issues. human-panic only displays a human-friendly panic message in release mode.
This commit is contained in:
parent
85fcf8faab
commit
d20eaaa4dd
28
Cargo.lock
generated
28
Cargo.lock
generated
@ -1501,6 +1501,22 @@ version = "1.0.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9"
|
||||
|
||||
[[package]]
|
||||
name = "human-panic"
|
||||
version = "1.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c4f016c89920bbb30951a8405ecacbb4540db5524313b9445736e7e1855cf370"
|
||||
dependencies = [
|
||||
"anstream",
|
||||
"anstyle",
|
||||
"backtrace",
|
||||
"os_info",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
"toml 0.8.9",
|
||||
"uuid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "humantime"
|
||||
version = "2.1.0"
|
||||
@ -2217,6 +2233,17 @@ dependencies = [
|
||||
"hashbrown 0.14.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "os_info"
|
||||
version = "3.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "006e42d5b888366f1880eda20371fedde764ed2213dc8496f49622fa0c99cd5e"
|
||||
dependencies = [
|
||||
"log",
|
||||
"serde",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "overload"
|
||||
version = "0.1.1"
|
||||
@ -2855,6 +2882,7 @@ dependencies = [
|
||||
"directories",
|
||||
"displaydoc",
|
||||
"gethostname",
|
||||
"human-panic",
|
||||
"humantime",
|
||||
"indicatif",
|
||||
"itertools",
|
||||
|
||||
@ -80,6 +80,7 @@ clap_complete = "4"
|
||||
dialoguer = "0.11.0"
|
||||
directories = "5"
|
||||
gethostname = "0.4"
|
||||
human-panic = "1.2.3"
|
||||
humantime = "2"
|
||||
indicatif = "0.17"
|
||||
itertools = "0.12"
|
||||
|
||||
@ -53,6 +53,7 @@ use clap::builder::{
|
||||
Styles,
|
||||
};
|
||||
use dialoguer::Password;
|
||||
use human_panic::setup_panic;
|
||||
use log::{log, Level};
|
||||
use rustic_core::{OpenStatus, Repository};
|
||||
use simplelog::{CombinedLogger, LevelFilter, TermLogger, TerminalMode, WriteLogger};
|
||||
@ -159,6 +160,9 @@ pub struct EntryPoint {
|
||||
|
||||
impl Runnable for EntryPoint {
|
||||
fn run(&self) {
|
||||
// Set up panic hook for better error messages and logs
|
||||
setup_panic!();
|
||||
|
||||
self.commands.run();
|
||||
RUSTIC_APP.shutdown(Shutdown::Graceful)
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user