rust error handling
Unrecoverable errors with panic!
By default, Rust walks back up the stack and cleans up the data from each function it encounters.
Walking back and cleaning up is a lot of work.
You can immediately abort and let the OS clean up by adding the following in the Cargo.toml
:
We can set the RUST_BACKTRACE
environment variable to get a backtrace of exactly what happened to
cause the error:
Recoverable errors with Result
Matching on different errors
Shortcuts for panic on Error: unwrap and expect
Propagating Errors