-
Notifications
You must be signed in to change notification settings - Fork 115
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
errors: Narrow return error type of Session::[query/execute]_iter #1191
base: main
Are you sure you want to change the base?
Conversation
See the following report for details: cargo semver-checks output
|
Flaky |
Now that we renamed I believe
|
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, but see my comment about introducing PrepareError
.
I 100% agree. New name clearly suggests that we should distinguish these two kinds of operations.
BTW, |
Opened a PR #1193 |
5ebcd79
to
8c46971
Compare
Rebased on main |
Last time during pager API errors refactor I missed that this return error type can be narrowed. There are two kinds of callers: 1. Session::query/execute_iter In this case, we needed to replace `QueryError::NextRowError` variant with NextPageError. However, this variant will be removed at the end of this PR as we introduce a new error type for aforementioned Session methods. 2. Connection::query/execute_iter This is an internal API. It's only used during metadata fetch. I decided to map it to `NextRowError`, because it doesn't make much sense to distinguish between these two from user's perspective. NextRowError will be returned later anyway, when we iterate over the rows.
It's an error returned by `[Caching]Session::[query/execute]_iter`.
8c46971
to
4289ea3
Compare
Rebased on main again (ssl CI fix, and removed legacy ser/deser api) |
Ref: #519
Motivation
NextPageError
andNextRowError
were introduced specifically forQueryPager
API. Currently (before this PR), the top-level Session methods[execute/query]_iter()
return aExecutionError
. This is whyNextRowError
variant is present inExecutionError
. To remove that, we can narrow the return error type of these methods.There is one subtle thing to pay attention to (and potentially discuss).
query_iter
method potentially prepares the statement (if values are not empty).Session::prepare
currently returns aExecutionError
. This is why newly introducedPagerExecutionError
now depends onExecutionError.
The question is whether we should narrow the return error type ofSession::prepare
to some new error type (PrepareError
), or leave it as is.Pre-review checklist
[ ] I added relevant tests for new features and bug fixes.[ ] I have adjusted the documentation in./docs/source/
.Fixes:
annotations to PR description.