-
Notifications
You must be signed in to change notification settings - Fork 112
[collector] Minimal Panic Fix #1560
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
Conversation
collector/src/lib.rs
Outdated
| #[derive(Error, Debug)] | ||
| pub enum Error { | ||
| #[error("send failed: {0}")] | ||
| SendFailed(AnyError), |
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.
This approach can be taken to finally finish #1200
| use commonware_p2p::{Recipients, Sender}; | ||
| use thiserror::Error; | ||
|
|
||
| /// Errors that can be returned by [Failing]. |
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 define a standalone error type here to avoid accidentally satisfying some test case (if matched against crate::Error)
| pub trait Sender: Clone + Debug + Send + 'static { | ||
| /// Error that can occur when sending a message. | ||
| type Error: Debug + StdError + Send; | ||
| type Error: Debug + StdError + Send + Sync; |
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.
Don't need to fix in this PR but we should have our own trait that requires all of these. Also it looks like std::error::Error already requires Debug, but it's fine to keep Debug here for now for consistency with other files in the monorepo
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.
Yeah, I almost added one but wanted to keep it minimal
| #[derive(Error, Debug)] | ||
| pub enum Error { | ||
| #[error("send failed: {0}")] | ||
| SendFailed(anyhow::Error), |
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.
so nice to not have to have a generic type on enum Error
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #1560 +/- ##
==========================================
+ Coverage 92.02% 92.07% +0.04%
==========================================
Files 284 286 +2
Lines 73163 73734 +571
==========================================
+ Hits 67331 67887 +556
- Misses 5832 5847 +15
... and 9 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
Fixes: #1548
Alternative: #1549