diff --git a/README.md b/README.md index 240086e..168c5aa 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,7 @@ and such might not want. - [... in `main()`](#-in-main) - [... diagnostic code URLs](#-diagnostic-code-urls) - [... snippets](#-snippets) + - [... multiple related errors](#-multiple-related-errors) - [... handler options](#-handler-options) - [Acknowledgements](#acknowledgements) - [License](#license) @@ -354,6 +355,26 @@ pub struct MyErrorType { } ``` +### ... multiple related errors + +`miette` supports collecting multiple errors into a single diagnostic, and +printing them all together nicely. + +To do so, use the `#[related]` tag on any `IntoIter` field in your +`Diagnostic` type: + +```rust +use miette::Diagnostic; +use thiserror::Error; + +#[derive(Debug, Error, Diagnostic)] +#[error("oops")] +struct MyError { + #[related] + Vec, +} +``` + ### ... handler options [MietteHandler] is the default handler, and is very customizable. In most