Expand description
Print panics in a sensible fashion.
First, place the following before your main
function:
use errata::FallibleExt;
#[errata::catch]
fn main() {
// ...
}
This unlocks pretty-printing for your error messages. For Option
and
Result
(as long as the Err
variant implements Display
), you can use
fail
as a drop-in replacement for expect
. You can
continue to use unwrap
and expect
where you don’t expect any errors,
and you will continue to get useful debug information just like normal.
If you wish to throw your own errors, see error
.
Macros§
- error
- Exits the program cleanly, calling destructors and printing an error message.
Uses the same syntax as
format
.
Traits§
- Fallible
Ext - The trait providing
fail
. Implemented forOption<T>
andResult<T, E: Display>
.
Attribute Macros§
- catch
- Sets up nice error handling for your Rust function.