4 levels of Rust error handling

Опубликовано: 02 Май 2026
на канале: timClicks
11,617
309

Strengthen your code one level at a time. Rust's errors can be confusing. Learn how to start with an easy path and grow as you knowledge increases. This video was produced first for patrons   / timclicks  


📚 Resources:

// Docs
Error Handling in Rust - A Deep Dive https://www.lpalmieri.com/posts/error...
Error Handling in Rust with Jane Lasore-Lusby https://rustacean-station.org/episode...
Error Handling in Rust (old! this one is how I learned!) https://blog.burntsushi.net/rust-erro...

// Slides
https://docs.google.com/presentation/...

// Crates
https://crates.io/crates/thiserror
https://crates.io/crates/eyre
https://crates.io/crates/anyhow

🦀 Rust resources:
Rust Documentation: https://doc.rust-lang.org/book/
Rust Playground: https://play.rust-lang.org/
Rust in Action (Tim's book!) https://mng.bz/4MlD
How to Learn Rust (online course!) https://learning.accelerant.dev/how-t...

👋 Connect with Tim:

Twitter:   / timclicks  
GitHub: https://github.com/timClicks
Mastodon: https://mastodon.nz/@timClicks
DEV: https://dev.to/timclicks/
Patreon (extra learning materials)   / timclicks  

Timeline

00:00:00 Introduction
00:01:04 Personal story about learning Rust error handling
00:04:39 Combing errors
00:05:18 Using std::error:Error trait objects
00:08:20 Programmer's view of an error
00:09:40 Type system's view of an error
00:11:32 What is a Result?
00:14:12 Individual modules/crates often define their own Error types
00:16:15 Level 1: Ignore Results
00:17:10 Using unwrap()
00:18:35 Using expect()
00:19:50 Assigning to underscore (_)
00:24:18 Level 2: Return strings as errors
00:25:15 Converting errors with map_err
00:26:40 Defining a function with String as an error type
00:31:34 Level 3: use enums as errors
00:37:20 Why bother to define a custom error type
00:41:50 Level 4: use crates to help

🔔 Subscribe to the channel and click the bell icon to stay updated with the latest videos and live streams from timClicks: https://www.youtube.com/timClicks?sub...

👍 Like this video if you found it helpful, and share it with your friends who are also interested in Rust programming.