-
Couldn't load subscription status.
- Fork 0
KOL-5 | feat: Enhance error handling with detailed KolmeError variants #403
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
base: main
Are you sure you want to change the base?
Conversation
Deploying kolme with
|
| Latest commit: |
bf28299
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://88566749.kolme.pages.dev |
| Branch Preview URL: | https://kol-5.kolme.pages.dev |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some comments for a change in general direction. When this is ready for another review, let's get @MichaelNelo on this too so I'm not a bottleneck.
2efdafe to
a75f49d
Compare
| processor.add_secret(new_processor.clone()); | ||
| testtasks.try_spawn_persistent(processor.run()); | ||
|
|
||
| // The genesis event hasn't completed, which causes this test to fail. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to figure this one out before merging this PR, this seems like a new regression since the tests are currently passing without the addition.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still working on this. I haven't found the reason.
| Other(String), | ||
| } | ||
|
|
||
| // CREATE A GENERIC, MACRO OR SOMETHING WITH SIMILAR BEHAVIOR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check the docs for thiserror, IIRC the #[from] pragma can be used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I can see, I can’t use something like:
#[error("CoreState error: {0}")]
CoreState(#[from] CoreStateError),
because KolmeError derives Clone, Serialize, and Deserialize, while most of the underlying errors do not implement these traits, which causes a compilation error. If I remove the Clone, Serialize, and Deserialize derives from KolmeError, a lot of things start breaking at different levels. Let me know if you’d like me to remove those derives.
| ) -> Result<()> { | ||
| anyhow::ensure!(self | ||
| ) -> std::result::Result<(), KolmeError> { | ||
| kolme_ensure!(self |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like this kolme_ensure is essentially being used to bypass the need for creating specific error variants. Instead, I'd want to see variants for the specific failure modes. To avoid creating one massive enum with hundreds of variants, a common approach would be defining a helper type, like KolmeExecuteError, in this module, and then providing an Execute(KolmeExecuteError) variant within KolmeError.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kolme_ensure! is simply replacing anyhow::ensure! at all different levels. For instance:
kolme_ensure!(info.validator_set.processor == processor);
kolme_ensure!(listeners == info.validator_set.listeners);
kolme_ensure!(needed_listeners == info.validator_set.needed_listeners);
kolme_ensure!(approvers == info.validator_set.approvers);
kolme_ensure!(needed_approvers == info.validator_set.needed_approvers);
I don't understand your request.
No description provided.