-
Notifications
You must be signed in to change notification settings - Fork 615
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
feat(error): preserve error's source chain across gRPC boundary #13282
Conversation
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
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.
Generally LGTM. Cool!
Could you please construct a real example in RisingWave where the err msg is improved? 🤪
use tonic::Code; | ||
|
||
let code = match &*err.inner { | ||
ErrorCode::ExprError(_) => Code::InvalidArgument, |
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.
ExprError => InvalidArgument doesn't look very correct 🤣
BTW, I was always wondering whether we should map application error code to tonic status code.. This is like the debate whether to use HTTP status code or simply use it as a wrapper and do everything in the payload. I don't have an answer. Just want to mention it. Let's just keep it until somebody is unhappy.
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.
I agree. I just leave the behavior unchanged in this PR. 😕
whether we should map application error code to tonic status code.
+1. And the only place we refer to it is the error message of Status
. 😄
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
I'll show you after #13264 and risinglightdb/sqllogictest-rs#200 🥰 |
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
Codecov Report
@@ Coverage Diff @@
## main #13282 +/- ##
========================================
Coverage 67.74% 67.74%
========================================
Files 1524 1525 +1
Lines 259435 259553 +118
========================================
+ Hits 175762 175847 +85
- Misses 83673 83706 +33
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 7 files with indirect coverage changes 📣 Codecov offers a browser extension for seamless coverage viewing on GitHub. Try it in Chrome or Firefox today! |
I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.
What's changed and what's your intention?
Recursively encode the error and its sources into into a data struct, filling it into the
details
field oftonic::Status
, then propagate it through the wire to the gRPC client and extract the source chain there withTonicStatusWrapper
. This follows the practice of the gRPC error handling guide.Organize the utilities into a new crate
risingwave_error
to draw a clear distinction with the error handling pattern inrisingwave_common::error
that's going to be deprecated.The idea goes back to #4227 (comment).
Preview
risingwave/e2e_test/error_ui/main.slt
Lines 13 to 20 in c37d889
Checklist
./risedev check
(or alias,./risedev c
)Documentation
Release note
If this PR includes changes that directly affect users or other significant modifications relevant to the community, kindly draft a release note to provide a concise summary of these changes. Please prioritize highlighting the impact these changes will have on users.