Crate human_panic[][src]

Panic messages for humans

Handles panics by calling std::panic::set_hook to make errors nice for humans.

Why?

When you're building a CLI, polish is super important. Even though Rust is pretty great at safety, it's not unheard of to access the wrong index in a vector or have an assert fail somewhere.

When an error eventually occurs, you probably will want to know about it. So instead of just providing an error message on the command line, we can create a call to action for people to submit a report.

This should empower people to engage in communication, lowering the chances people might get frustrated. And making it easier to figure out what might be causing bugs.

Default Output

thread 'main' panicked at 'oops', examples/main.rs:2:3
note: Run with `RUST_BACKTRACE=1` for a backtrace.

Human-Panic Output

Well, this is embarrassing.

human-panic had a problem and crashed. To help us diagnose the problem you can send us a crash report.

We have generated a report file at "/var/folders/zw/bpfvmq390lv2c6gn_6byyv0w0000gn/T/report-8351cad6-d2b5-4fe8-accd-1fcbf4538792.toml". Submit an issue or email with the subject of "human-panic Crash Report" and include the report as an attachment.

- Homepage: https://github.com/yoshuawuyts/human-panic
- Authors: Yoshua Wuyts <yoshuawuyts@gmail.com>

We take privacy seriously, and do not perform any automated error collection. In order to improve the software, we rely on people to submit reports.

Thank you kindly!

Macros

setup_panic

human-panic initialisation macro

Structs

Metadata

A convenient metadata struct that describes a crate

Functions

handle_dump

Utility function which will handle dumping information to disk

print_msg

Utility function that prints a message to our human users