-
Notifications
You must be signed in to change notification settings - Fork 590
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(connector): migrate anyhow::Error
to ConnectorError
newtype
#15042
refactor(connector): migrate anyhow::Error
to ConnectorError
newtype
#15042
Conversation
3b29e67
to
2dbb5fc
Compare
8e971ef
to
126a58c
Compare
dc3fda4
to
e114eee
Compare
69b9078
to
8a722eb
Compare
8a722eb
to
de0233c
Compare
cfaeeed
to
299e32d
Compare
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!
At first I thought maybe it's not necessary to replace all anyhow::Error
to the newtype (although this is easiest from the refactoring's point of view), but only need to change public APIs. But I quite like the added .context()
s. This feels like a dynamic version of thiserror
and thus I think we can use it more widely. 😄
temp_file = Some(f); | ||
temp_file = Some( | ||
create_credential_temp_file(&credentials) | ||
.context("failed to create temp file for pulsar credentials")?, |
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.
😄
if payload.is_empty() { | ||
self.value = Some("{}".into()); | ||
} else { | ||
self.value = Some(payload); | ||
} | ||
let value = simd_json::to_borrowed_value( | ||
&mut self.value.as_mut().unwrap()[self.payload_start_idx..], | ||
)?; | ||
) | ||
.context("failed to parse json payload")?; |
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.
What about printing the payload here in the ctx? So that we can e.g., make the error msg in #13937 nicer
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.
Oh, it seems we can't print it without clone
299e32d
to
1e6e6c2
Compare
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!
1e6e6c2
to
fbb6b07
Compare
cf13de1
to
0357432
Compare
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>
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>
0357432
to
ba75e21
Compare
Merge activity
|
I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.
What's changed and what's your intention?
Follow-up of #15086.
anyhow::Result
toConnectorResult
.risingwave/src/connector/src/error.rs
Lines 24 to 61 in de0233c
ParseIntError
.context
andbail
to wrap and construct errors.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.