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
46
47
48
///# Error
/// Logs errors and then kills the program with exit code 1.
///
///## ⚠WARNING⚠
/// `error!` creates a hook for `panic!` which also silences the typical error message.
/// This hook applies to ALL uses of panic once `error!` has been invoked.
/// The `panic!` macro will be affected for the rest of your program's runtime.
///
/// Examples
///
/// Kill program
/// ```no_run
///# use info_utils::prelude::*;
///# fn main() {
/// // Something is happening..
/// // Uh oh, an error has occurred.
/// error!("Something unrecoverable went wrong!");
///# }
///```
///
///Kill thread
/// ```rust
///# use std::thread;
///# use info_utils::prelude::*;
///# fn main() {
/// thread::spawn(|| {
/// // Do a calculation
/// // Oh no, an error happened and we need to kill the thread!
/// error!("Noncritical error, thread aborting");
/// }).join().eval_or_default();
///# }
///```