Skip to content
Free public beta until December 4, 2026: every course is open, no card needed. After that, the first chapter of each course stays free and full access is a one-time $39 ($19 for up to 100 founding members chosen for helpful feedback). Your progress is kept. How the beta works

thiserror

A crate that writes the Error and Display boilerplate for your error types.

thiserror's #[derive(Error)] implements std::error::Error, Display (from #[error(...)]), and From (from #[from]) for an error type; it adds nothing to the public API.

Examples

  • #[derive(Debug, thiserror::Error)] on enum ConfigError with #[error("unknown setting {0}")] UnknownKey(String) writes the Display and Error impls for you.

  • #[error(transparent)] Io(#[from] std::io::Error) also writes From<io::Error>, so ? converts an I/O error into ConfigError::Io.

Read the full section →