-
Notifications
You must be signed in to change notification settings - Fork 599
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(array): introduce ArrayError & unify ensure!
by anyhow!
#3130
Conversation
Signed-off-by: Bugen Zhao <[email protected]>
Signed-off-by: Bugen Zhao <[email protected]>
Signed-off-by: Bugen Zhao <[email protected]>
Signed-off-by: Bugen Zhao <[email protected]>
Signed-off-by: Bugen Zhao <[email protected]>
Codecov Report
@@ Coverage Diff @@
## main #3130 +/- ##
==========================================
+ Coverage 73.75% 73.76% +0.01%
==========================================
Files 736 737 +1
Lines 101680 101611 -69
==========================================
- Hits 74992 74955 -37
+ Misses 26688 26656 -32
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more |
ensure!
by anyhow!
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.
ArrayError's Debug impl could be modified to print backtrace, so that we can diagnose error more easily in the future.
fn read(buf: &[u8]) -> ArrayResult<Decimal> { | ||
match Decimal::from_str(Utf8ValueReader::read(buf)?) { | ||
Ok(d) => Ok(d), | ||
Err(e) => bail!("failed to read decimal from string: {}", e), |
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 would be better to use anyhow's context function to attach extra info to an existing error.
What's changed and what's your intention?
This PR introduces
ArrayError
, and unifies theensure
macro by usinganyhow!
everywhere so that it can work under any context includingRwError
,ArrayError
, andExprError
.Checklist
./risedev check
(or alias,./risedev c
)Refer to a related PR or issue link (optional)