# Simplify error handling

**URL:** <https://internals.rust-lang.org/t/simplify-error-handling/12226>\
**Category:** language design\
**Created:** [April 24, 2020, 4:12pm UTC](https://internals.rust-lang.org/t/simplify-error-handling/12226 "2020-04-24T16:12:00Z")\
**Posts on this page:** 1\
**Showing post:** 21

<div class="post-metadata">

**Author:** ![redradist](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/redradist/32/6475_2.png) [@redradist](https://internals.rust-lang.org/u/redradist)\
**Post date:** [April 24, 2020, 10:32pm UTC](https://internals.rust-lang.org/t/simplify-error-handling/12226/21 "2020-04-24T22:32:39Z")

</div>

> [@josh](#):
>
> Depending on what you're looking for, you could also use `anyhow::Result<u32>`, which will wrap any error you like and not require creating any types. You can still get a specific error type out of it if you need to (using downcasting), and in the common case where all errors just get reported without being matched on, you don't need to do anything at all.
> 
> Might that give you the reduced boilerplate you're looking for?

It is nice !!

But I think it would be better anyway to use anonymous enums, because it do not enforce user type to impl `From` trait and much better match expression

Also anonymous enums is usable for other types as &[Error | MyError] and so on ...

---

_[View the full topic](https://internals.rust-lang.org/t/simplify-error-handling/12226)._
