Repository navigation
feat(spanner): add support of checking row not found errors from ReadRow and ReadRowUsingIndex - #10405
Merged
Conversation
rahul2393
force-pushed
the
support_errors_is
branch
2 times, most recently
from
June 21, 2024 13:58
b550e3b to
a8e5581
Compare
…Row and ReadRowUsingIndex
rahul2393
force-pushed
the
support_errors_is
branch
from
June 21, 2024 14:03
a8e5581 to
bacee62
Compare
olavloite
reviewed
Jun 21, 2024
|
|
||
| var ( | ||
| // ErrRecordNotFound record not found error | ||
| ErrRecordNotFound = errors.New("record not found") |
Contributor
There was a problem hiding this comment.
ErrRowNotFound corresponds better with the original error message row not found...
Suggested change
| ErrRecordNotFound = errors.New("record not found") | |
| ErrRowNotFound = errors.New("record not found") |
| // | ||
| // If no row is present with the given index, then ReadRowUsingIndex returns an | ||
| // error where spanner.ErrCode(err) is codes.NotFound. | ||
| // error(spanner.ErrRecordNotFound) where spanner.ErrCode(err) is codes.NotFound. |
Contributor
There was a problem hiding this comment.
Also here: Maybe add an example in the comments for how users should check for this specific error.
rahul2393
force-pushed
the
support_errors_is
branch
from
June 21, 2024 14:29
c04025c to
bda801f
Compare
olavloite
reviewed
Jun 21, 2024
| // | ||
| // To check if the error is spanner.ErrRecordNotFound: | ||
| // | ||
| // if errors.Is(err, ErrRecordNotFound) { |
Contributor
There was a problem hiding this comment.
Suggested change
| // if errors.Is(err, ErrRecordNotFound) { | |
| // if errors.Is(err, ErrRowNotFound) { |
olavloite
reviewed
Jun 21, 2024
| // | ||
| // To check if the error is spanner.ErrRecordNotFound: | ||
| // | ||
| // if errors.Is(err, ErrRecordNotFound) { |
Contributor
There was a problem hiding this comment.
Suggested change
| // if errors.Is(err, ErrRecordNotFound) { | |
| // if errors.Is(err, ErrRowNotFound) { |
olavloite
reviewed
Jun 21, 2024
| // error where spanner.ErrCode(err) is codes.NotFound. | ||
| // error(spanner.ErrRowNotFound) where spanner.ErrCode(err) is codes.NotFound. | ||
| // | ||
| // To check if the error is spanner.ErrRecordNotFound: |
Contributor
There was a problem hiding this comment.
Suggested change
| // To check if the error is spanner.ErrRecordNotFound: | |
| // To check if the error is spanner.ErrRowNotFound: |
olavloite
reviewed
Jun 21, 2024
| // | ||
| // To check if the error is spanner.ErrRecordNotFound: | ||
| // | ||
| // if errors.Is(err, ErrRecordNotFound) { |
Contributor
There was a problem hiding this comment.
Suggested change
| // if errors.Is(err, ErrRecordNotFound) { | |
| // if errors.Is(err, ErrRowNotFound) { |
rahul2393
force-pushed
the
support_errors_is
branch
from
June 21, 2024 14:37
1838660 to
02d99fd
Compare
olavloite
approved these changes
Jun 21, 2024
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes: #10031
Customers can check row not found cases with below condition