telegram-bot
telegram-bot copied to clipboard
Use 'failure' instead of 'error-chain'
Also I updated examples
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!
failure crate is more useful than error-chain:
- You don't need to write
error-chainlinks or foreign links to other errors. - You can write
Result<T, failure::Error>instead ofResult<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.
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)