typestar

Error handling

15 steps in 5 sets of Rust.

Rust has no exceptions, so error handling is in the type system and you cannot ignore it by accident. Option first, then Result and the ? operator that makes it bearable.

Then writing your own error types, which is where most real projects end up, and finally panics: when to use them, how to catch them, and why unwrap in library code will eventually embarrass you.

Start this tour

Option

Result & the ? operator

Your own error types

Panics & recovery

Encore

  • config_check.rsA validation pipeline: parse key-value text, collect every problem, report.

The other Rust tours