errorstash
A library for collecting multiple related errors, and reporting them together.
Error stashes are useful when you want to perform multiple operations that may independently fail, and you want to collect all errors that occur and return them together, rather than failing fast on the first error. For example, when validating data, you may want to provide the caller with a complete list of validation errors so that they can fix them all at once.
use HashSet;
use Url;
use Error;
use ;
;
;
;
This crate defines an
ErrorStash
trait along with two struct implementations:
BoxedStasha stash that wraps its child errors in aBox<dyn Error + Send + Sync + 'static>, allowing a mix of different child error types, and emitting them together in anErrorListTypedStasha stash with a generic type for its child errors, requiring all errors to have the same type, and allowing for custom wrapper error types
Related projects
This project was inspired by
lazy_errors, including the error
stash concept and the integration with the Result and Iterator types. This
project attempts to offer a simpler API and support for fully custom wrapper
error types.
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.