Chillpill
A more powerful (and more restrictive) std::panic::catch_unwind.
chillpill::catch is able to suppress the default panic message printed to
stderr and return the source code location (file, line, and column) of the
panic, at the cost of requiring that no other code modifies the
global panic hook during
its execution.
See the chillpill::catch documentation for a full list of differences from
std::panic::catch_unwind, and more information on the panic hook restriction.
Example Usage
chillpill::catch is a drop-in replacement for std::panic::catch_unwind:
use ;
$ cargo run
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.00s
Running `target/x86_64-unknown-linux-gnu/debug/example`
The panic occurred in src/main.rs on line 11, column 9.
License
Licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.