pretty-panic 1.0.4

A simple library for nicer panic messages.
Documentation
  • Coverage
  • 50%
    2 out of 4 items documented2 out of 2 items with examples
  • Size
  • Source code size: 6.43 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.06 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 12s Average build duration of successful builds.
  • all releases: 12s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • InYourWalls

pretty-panic

A Rust library to make your ugly panic messages nicer for the end users.

What is it?

pretty-panic is a small library that wraps around std::panic::set_hook, allowing you to set your own panic handler functions. It provides a default handler, which just prints a nicer panic message.

How to use?

Code:

use pretty_panic::pretty_panic;

fn main() {
    pretty_panic!(/* you would put your handler function here */);

    panic!("explicit call to panic!()");
}

Output:

Uh oh!

The program experienced a fatal error, and has panicked. Recommend you contact one
of the authors for assistance. See below for some additional information:

(If you are going to submit a bug report, include the entirety of this message!)
pretty-panic v0.1.0 () - panic start
     panic from thread [main]:
         panicked at 'explicit call to panic!()', examples/simple.rs:6:5

Submit bug report to the authors:
pretty-panic v0.1.0 () - panic end

Installation

Add the following to the [dependencies] section in your Cargo.toml file:

[dependencies]
pretty-panic = "1.0"