Skip to content
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

Unify error enums & generation #857

Closed
tomusdrw opened this issue Apr 1, 2021 · 1 comment
Closed

Unify error enums & generation #857

tomusdrw opened this issue Apr 1, 2021 · 1 comment
Labels
A-chores Something that has to be done, as part of regular maintenance Good First Issue Good for newcomers P-Relay

Comments

@tomusdrw
Copy link
Contributor

tomusdrw commented Apr 1, 2021

Currently we mostly use manually implemented Error enums across the codebase. These enums do not necessarily implement std::error::Error trait, which is fine for runtime stuff, but would be useful for relayer code.
The relayer code is using String errors though, cause we mostly don't care about anything specific, but need to propagate it up in the stack.

Recently in #813 anyhow got introduced and now with #849 there is even more error-specific refactorings being done.
@adoerr suggested to use anyhow / thiserror combo to unify error handling which I think is the right idea.

Basically the rule is:

  • anyhow for the last mile CLI stuff, where we really don't care about the error.
  • thiserror for non-cli libraries that are used outside of the runtime to avoid manual Display/std::io::Error implementation.
@tomusdrw tomusdrw added Good First Issue Good for newcomers A-chores Something that has to be done, as part of regular maintenance B-Substrate <> Substrate P-Relay labels Apr 1, 2021
@tomusdrw tomusdrw added this to the Nice to Have milestone Apr 1, 2021
vmarkushin added a commit to vmarkushin/parity-bridges-common that referenced this issue Jul 11, 2021
Related to paritytech#857

There are many String-typed errors that could be transformed to similar error enums, but since they only used once, I decided to not touch them and just change the existing ones (although, it could improve readability).
vmarkushin added a commit to vmarkushin/parity-bridges-common that referenced this issue Aug 28, 2021
Related to paritytech#857

There are many String-typed errors that could be transformed to similar error enums, but since they only used once, I decided to not touch them and just change the existing ones (although, it could improve readability).
vmarkushin added a commit to vmarkushin/parity-bridges-common that referenced this issue Oct 14, 2021
tomusdrw pushed a commit that referenced this issue Oct 22, 2021
…1094)

* Unify error enums in substrate and ethereum clients with `thiserror`

Related to #857

* Add license pre-amble

* rustfmt

* Fix spelling
@tomusdrw
Copy link
Contributor Author

Assuming closed with #1094

serban300 pushed a commit to serban300/parity-bridges-common that referenced this issue Mar 27, 2024
…aritytech#1094)

* Unify error enums in substrate and ethereum clients with `thiserror`

Related to paritytech#857

* Add license pre-amble

* rustfmt

* Fix spelling
serban300 pushed a commit to serban300/parity-bridges-common that referenced this issue Apr 8, 2024
…aritytech#1094)

* Unify error enums in substrate and ethereum clients with `thiserror`

Related to paritytech#857

* Add license pre-amble

* rustfmt

* Fix spelling
bkchr pushed a commit to paritytech/polkadot-sdk that referenced this issue Apr 10, 2024
…(#1094)

* Unify error enums in substrate and ethereum clients with `thiserror`

Related to paritytech/parity-bridges-common#857

* Add license pre-amble

* rustfmt

* Fix spelling
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-chores Something that has to be done, as part of regular maintenance Good First Issue Good for newcomers P-Relay
Projects
None yet
Development

No branches or pull requests

1 participant