Use the thiserror::Error derive macro on your error enum to automatically implement std::error::Error and define display messages via attributes.
use thiserror::Error;
#[derive(Error, Debug)]
pub enum Error {
#[error("No config for '{0}'")]
NoConfig(String),
#[error(transparent)]
Mdbook(#[from] mdbook_preprocessor::errors::Error),
}
This pattern allows you to define custom error messages with placeholders and transparently wrap other errors using #[from] for automatic conversion.