ANN: from_error_scope provides scoped Error translation with trys!

The use of try! and FromError can simplify error handling in code. However, FromError has two limitations: it is global in scope, and you can't impl it on non-local Error types.

To address this I have been using from_error_scope which provides a FromErrorScope trait that you implement on a local scope type, and a trys! macro that works like try!, but takes an additional, initial scope object argument.

Documentation

I just want to understand the use case a little better. Right now, it seems the best practice is to create a library-local Error type, which handles FromError for all the other types of errors your library might encounter.

With this, you are translating between two external library errors?

Hello Adam!

One example is when using external crates to generate HTTP Responses with Iron. You might use a crate library that returns a UrlDecodeError and want to turn it into an IronError to return from your handler.

Generalising, I expect you will encounter this whenever using some sort of framework, which prescribes its own error types.

Having said that, I think the scoped translations are useful, even for translation to local Error types.

Hugo