-
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
refactor(error): eliminate usage of DisplayErrorContext
#15225
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This was referenced Feb 23, 2024
1c367e9
to
e28b9d6
Compare
8670b57
to
39e5a2a
Compare
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
e28b9d6
to
468f7ec
Compare
BugenZhao
commented
Feb 26, 2024
@@ -106,10 +105,8 @@ impl Sink for KinesisSink { | |||
.stream_name(&self.config.common.stream_name) | |||
.send() | |||
.await | |||
.map_err(|e| { | |||
tracing::warn!("failed to list shards: {}", DisplayErrorContext(&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.
There should be a principle that "whoever handles the error is responsible for logging the error". The error here is thrown and should be handled (or logged) by the caller.
wenym1
approved these changes
Feb 26, 2024
xxchan
approved these changes
Feb 26, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.
What's changed and what's your intention?
Eliminate usages of
DisplayErrorContext
, which is similar tothiserror_ext::Report
. Several reasons:Report
/DisplayErrorContext
should only be used when printing the entire error at the top level. For theDisplay
implementation of an error type, the best practice is not to include theDisplay
of the source chain.Report
strips the common suffix of errors'Display
implementation to make it clean, whileDisplayErrorContext
does not.DisplayErrorContext
attaches aDebug
view of the error after formatting the error source chain. This makes the result verbose, not composable, and not able to be cleaned up byReport
.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.