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

mockgcp: Refactor errors from storage.Get #1210

Closed

Conversation

justinsb
Copy link
Collaborator

@justinsb justinsb commented Feb 8, 2024

Going through one method at a time, but the code is much simplified by
having storage.Get return an object that follows the GRPC design
patterns, where codes.NotFound is returned when the object is not
found.

Going through one method at a time, but the code is much simplified by
having storage.Get return an object that follows the GRPC design
patterns, where codes.NotFound is returned when the object is not
found.
@justinsb
Copy link
Collaborator Author

justinsb commented Feb 8, 2024

/assign @cheftako

Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: justinsb

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@@ -125,7 +131,7 @@ func (s *typeStorage) Get(ctx context.Context, fqn string, dest proto.Message) e

existing, found := s.byKey[fqn]
if !found {
return apierrors.NewNotFound(schema.GroupResource{}, fqn)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I like concentrating these concerns in the storage layer. However I think we still have 1 of the issues I originally brought up here. Why return an explicit code.NotFound error for Get() when the key is not found but not for Update() or Delete() when the key is not found (lines 98 and 111). Why not codes.AlreadyExists for Create() at line 74?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ah, because I want to save tasty PR treats for tomorrow/Monday :-) But now you've gone and ruined the surprise...

@justinsb
Copy link
Collaborator Author

Merged in #1221 (thanks!), closing

/close

@google-oss-prow google-oss-prow bot closed this Feb 10, 2024
Copy link
Contributor

@justinsb: Closed this PR.

In response to this:

Merged in #1221 (thanks!), closing

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants