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

Collect all HolochainError types in an enum #281

Open
jost-s opened this issue Oct 17, 2024 · 2 comments
Open

Collect all HolochainError types in an enum #281

jost-s opened this issue Oct 17, 2024 · 2 comments

Comments

@jost-s
Copy link
Contributor

jost-s commented Oct 17, 2024

Errors thrown by the client are of type HolochainError. One property is a name, which is a string. Instead it would be better to use an enum, so that there are no spelling mistakes when throwing or catching errors, and to have a central location where all possible errors are placed.

AC:

  • Create HolochainErrorKind enum.
  • Modify HolochainError to accept a value of the HolochainErrorKind enum instead of a name string.
  • Updarte all occurrences of HolochainError.
@ThetaSinner
Copy link
Member

I agree this would be good, but the errors from Holochain are structured to several levels of depth and seriously confusing to decode and decipher. I think we should approach this from Holochain first and simplify what you can receive as errors then look at doing this. What do you think?

@jost-s
Copy link
Contributor Author

jost-s commented Oct 28, 2024

We can do that first, but the errors in the client here are not directly mapped to Holochain errors or even unrelated to Holochain. There are for example InvalidTokenError, WebsocketClosedError or InvalidMessageFormatError. Those I'd like to create an enum for instead of using strings literals.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants