-
Notifications
You must be signed in to change notification settings - Fork 332
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
refactor: remove macro define_opaque_error
#812
Conversation
Signed-off-by: Ruihang Xia <[email protected]>
Signed-off-by: Ruihang Xia <[email protected]>
Signed-off-by: Ruihang Xia <[email protected]>
Codecov Report
@@ Coverage Diff @@
## develop #812 +/- ##
===========================================
- Coverage 85.38% 85.22% -0.17%
===========================================
Files 417 416 -1
Lines 54380 54364 -16
===========================================
- Hits 46435 46333 -102
- Misses 7945 8031 +86
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
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.
LGTM
IIRC there has long been a mixed usage of |
The main purpose is to allow crates to create their own opaque error type for traits, thus they can also implement some methods for their error types. Another consideration is that each implementation might have different variants for its error. It might be not easy to unify these variants into a few categories. But in practice, it looks a little verbose and inconvenient to use such an opaque error. |
I don't think this is the reason to keep this macro. As I mentioned in the very beginning, it can be achieved by
If it is to provide a generic error interface for trait methods, I don't see any functionality differences between bare dynamic error and named dynamic error. |
The most inconvenient thing is that you need to write lots of |
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.
Anyway, I'm fine to remove the usage of define_opaque_error
, so I'm going to approve this.
This deal is done when we decided to use snafu, right? It's really confusing if you write it in some place, but aren't willing to write it here. |
Signed-off-by: Ruihang Xia <[email protected]>
* refactor: remove macro define_opaque_error Signed-off-by: Ruihang Xia <[email protected]> * impl BoxedError Signed-off-by: Ruihang Xia <[email protected]> * fix tests Signed-off-by: Ruihang Xia <[email protected]> * remove open-region error Signed-off-by: Ruihang Xia <[email protected]> Signed-off-by: Ruihang Xia <[email protected]>
I hereby agree to the terms of the GreptimeDB CLA
What's changed and what's your intention?
define_opaque_error
provides a convenient way to define opaque error type. It's useful for util shim type likeBoxedError
, but it also gets confused when applied to normal errors. It creates a way to bypass pre-defined error enumerations, and place an arbitrary source error into one type.This might be useful when trying to expose an error type in the trait method, but it can also be done by defining a generic error type that accepts
BoxedError
, likeQueryExecution
.Checklist
Refer to a related PR or issue link (optional)