-
Notifications
You must be signed in to change notification settings - Fork 224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Failure crate: "soft ecosystem deprecated" #150
Comments
I think we should use We could, of course, write a bunch of boilerplate code ourself and not depend on any other lib but this will eat our time for no good reason. ref related issue: #139. |
What does that mean for the error type itself in the light module, will it be modeled like in the anomaly example and carry an enum kind?
What is the typical boilerplate code we would have to maintain? I think it's important to know the cost/downsize.
|
We have an enum with different errors (ErrorKind) anyways because we want to differentiate between different errors.
See for example: https://doc.rust-lang.org/src/std/io/error.rs.html#91-174 (the whole file actually) |
For an example using thiserror only see: https://github.com/interchainio/tendermint-rs/blob/e181405c9786becec3ad0f2e86d50466eae08674/tendermint/src/lite/errors.rs |
With issue #139 and PR #149 we introduced using On the other hand, in #149, the combination of PR #158 makes error handling consistent across modules in this crate. The pattern used can be briefly described as follows: Where it makes sense, e.g., to improve readability, we use the Additional reading:
Note that previously, the code was structured in a very similar fashion as described above. But with the naming slightly less consistent (e.g. [1]: Actually, there is one exception: The RPC errors need to be encoded in a particular way (see the go-code and its counterpart in rust). |
Related discussion: Light: more data in errors #149 (comment)
Reasoning in abscissa repo: crates: Replacements for failure? iqlusioninc/abscissa#144
Good read: https://blog.yoshuawuyts.com/error-handling-survey/
Currently:
https://github.com/interchainio/tendermint-rs/blob/f9287e04ee84e6659ea209529a1bb700ab53e45b/tendermint/Cargo.toml#L36
Used in:
We should switch to a combination of thiserror + anonmaly for the whole code base as done in #151 and #149 for the light client module.
The text was updated successfully, but these errors were encountered: