-
Notifications
You must be signed in to change notification settings - Fork 126
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: rename RequestError and make it private #1168
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 is the only PUBLIC occurrence of RequestError. Since we want to ultimately make it private, let's hide it behind an Arc. Why is it OK to do so? 1. This is a very rare error case. 2. I don't think users would be interested in checking the exact error cause via matches. 3. We no longer need to expose RequestError in the public API - this is a really low-level error that occurs on a connection level.
5252aa7
to
f480b0e
Compare
See the following report for details: cargo semver-checks output
|
wprzytula
approved these changes
Jan 15, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
semver-checks-breaking
cargo-semver-checks reports that this PR introduces breaking API changes
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.
Ref: #519
Motivation
Current
RequestError
is a low-level (connection layer) error that represents a failure of ANY CQL request. Before this PR it was public. Why? There was only one place it was used in public API - namelyBrokenConnectionErrorKind::KeepaliveQueryError
. This is a very rare error.I decided to make this error type
pub(crate)
for multiple reasons:InternalRequestError
(since it becomes an error used only in driver's internals)RequestError
name is now available :). It can be used for some more meaningful error returned from user-facing API. For example, an error representing a definite request failure that occurs in a session layer after possible retries, speculative execution etc.I've hidden this type in
BrokenConnectionErrorKind::KeepaliveRequestError
(variant got renamed as well) behind anArc
. It's OK to do so, because this specific case is very rare. I think that not providing any additional context (i.e., ignoring the underlying error cause) is a valid alternative solution.Pre-review checklist
[ ] I added relevant tests for new features and bug fixes.[ ] I have provided docstrings for the public items that I want to introduce.[ ] I have adjusted the documentation in./docs/source/
.Fixes:
annotations to PR description.