Hello,
I have a little application with error management done with error-chain
.
I would like to migrate it to failure
.
I have read thought failure
documentation, but I can't figure out which pattern should I use for myself.
Initially I tried to use Result<T, failure::Error>
as return type.
However, I got errors like
the trait `std::convert::From<failure::Error>` is not implemented for `jsonrpc_core::Error`
As I understand it happens because jsonrpc_core::Error
doesn't implement std::error::Error
.
And I can't implement it because both types are remote.
As far as understand it means that I have to return not failure::Error
but my custom error type.
So, then I tried to use Result<T, Error>
where Error
is my enum.
I created a Gist file with what I got with error-chain
and how I changed it with failure
.
Though I totally not sure if I made all the things right. In particular, now I have to write down few impl From<> for Error
.
I guess if it should be done or maybe there is a better way.
Could you please to review the code and provide any comments?
Please tell me if I could provide any additional information.
Thanks.