telegram-bot icon indicating copy to clipboard operation
telegram-bot copied to clipboard

Use 'failure' instead of 'error-chain'

Open ark0f opened this issue 7 years ago • 3 comments

Also I updated examples

ark0f avatar Nov 25 '18 16:11 ark0f

Thanks for this PR @ark0f! I'll review this shortly, I think that is more cleaner with failure but I don't know this crate yet, could you explain the major benefits? thanks!

Emulator000 avatar Nov 25 '18 20:11 Emulator000

failure crate is more useful than error-chain:

  • You don't need to write error-chain links or foreign links to other errors.
  • You can write Result<T, failure::Error> instead of Result<T, std::io::Error>, Result<T, hyper::Error>, etc.
  • You don't need to cast one error to another using map_err, because it is universal error type for all errors.

It is especially useful for futures, because one future can use just one error type.

ark0f avatar Nov 25 '18 20:11 ark0f

Is this likely to be merged soon @Emulator000? Use of failure is encouraged in the Rust ecosystem and allows easy integration with other crates (eg. diesel, actix-web)

jtfell avatar Dec 21 '18 04:12 jtfell