Skip to content
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(expr): better error handling and reporting for expressions #11420

Closed
wants to merge 10 commits into from

Conversation

BugenZhao
Copy link
Member

@BugenZhao BugenZhao commented Aug 3, 2023

Signed-off-by: Bugen Zhao i@bugenzhao.comI hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.

What's changed and what's your intention?

See #11443 for the background.

Attempt to use snafu to refactor error types for expression crate.

#[snafu(display("failed to call udf `{ident}`"))]
Udf {
#[snafu(source(from(risingwave_udf::Error, Box::new)))]
source: Box<risingwave_udf::Error>,
ident: Box<str>,
},

Benefits compared to thiserror:

  • Directly from the inner type (risingwave_udf::Error) of the boxed error.
  • Follow the convention of source and provide more strictly.
  • Structs like UdfSnafu allow us to construct errors more easily by avoiding repeating the source error and performing implicit cast (&str -> Box<str>), which encourages developers to provide more context.

let output = self
.client
.call(&self.identifier, input)
.instrument_await(self.span.clone())
.await
.context(UdfSnafu {
ident: self.identifier.as_str(),
})?;

Checklist

  • I have written necessary rustdoc comments
  • I have added necessary unit tests and integration tests
  • All checks passed in ./risedev check (or alias, ./risedev c)

Documentation

  • My PR contains user-facing changes.
Click here for Documentation

Types of user-facing changes

Please keep the types that apply to your changes, and remove the others.

  • Installation and deployment
  • Connector (sources & sinks)
  • SQL commands, functions, and operators
  • RisingWave cluster configuration changes
  • Other (please specify in the release note below)

Release note

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>
…ndling-attempt-snafu

Signed-off-by: Bugen Zhao <i@bugenzhao.com>
github-actions[bot]

This comment was marked as outdated.

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>
@BugenZhao BugenZhao force-pushed the bz/normalize-error-handling-attempt-snafu branch from 6e21881 to 8d35cb7 Compare August 4, 2023 05:46
@BugenZhao BugenZhao requested a review from wangrunji0408 August 4, 2023 06:57
remaining: usize,
finished: bool,
f: &'a mut Formatter<'b>,
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
}
}

@github-actions
Copy link
Contributor

This PR has been open for 60 days with no activity. Could you please update the status? Feel free to ping a reviewer if you are waiting for review.

@BugenZhao
Copy link
Member Author

Superseded by #11443 (comment) 🤡

@BugenZhao BugenZhao closed this Nov 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants