errors: rename RequestError and make it private #1168
Merged
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.