Rust theorytheory 0/50 · 0%
Error handling · medium

28. Error Types and thiserror/anyhow

Designing library and application errors.

Libraries define concrete error enums implementing std::error::Error, often derived with thiserror. Applications frequently use anyhow::Result for ergonomic context-rich propagation. Add context near the failure so logs explain what was being attempted.

Check your understanding

  1. 1. Which crate suits application-level errors?

  2. 2. Library errors should be…