1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
//! # Catching panics
//!
//! Just use
//!
//! ```rust
//! let result = scoped_panic_hook::catch_panic(|| panic!("Oopsie!"));
//!
//! if let Err(panic) = result {
//! eprintln!("{}", panic.display_with_backtrace());
//! }
//! ```
//!
//! Any panic which happens inside closure supplied to [`catch_panic`]
//! will be caught
//!
//! # Using manual panic hooks
//!
//! In case you want to do something nontrivial, you can analyze panics manually
//!
//! ```rust
//! let mut counter = 0;
//!
//! let _ = scoped_panic_hook::hook::catch_unwind_with_scoped_hook(
//! |_| { counter += 1; scoped_panic_hook::hook::NextHook::PrevInstalledHook },
//! || panic!("Oopsie!")
//! );
//!
//! println!("Caught panics: {counter}");
//! ```
// `core::panicking::panic_nounwind` in tests
/// Raw API for setting up scoped panic hooks
/// Panic capture types and functions,
/// including some with finer tuned functionality
pub use ;