tool-sync icon indicating copy to clipboard operation
tool-sync copied to clipboard

Consider using `human-panic` for better error reporting

Open popzxc opened this issue 3 years ago • 2 comments

Heya! Looking at this file it seems that you've imlpemented a small toolset for graceful exits upon meeting an irrecoverable error.

However, there exists a crate named human-panic which serves the same functionality, but handles everything automatically and provides more info for debug. As a bonus, it'll also catch any other panic if it'll ever occur.

popzxc avatar Aug 30 '22 08:08 popzxc

Thanks for the suggestion! I haven't heard about the human-panic package, it looks cool 👍🏻 I guess, the only argument for not using it is to have fewer dependencies 🤔

Also, in my file I'm using process::exit(1) instead of panic!("..."). Will there be any difference?

chshersh avatar Aug 30 '22 08:08 chshersh

Well, Rust uses error code 101 for panics. I don't think there should be any other differences related to the process termination.

popzxc avatar Aug 30 '22 08:08 popzxc