-
Notifications
You must be signed in to change notification settings - Fork 108
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
Return error when fetching the snapshot fails #233
Return error when fetching the snapshot fails #233
Conversation
@@ -169,6 +169,7 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest) | |||
if resp != nil && resp.StatusCode == http.StatusNotFound { | |||
return nil, status.Errorf(codes.NotFound, "snapshot %q not found", snapshotID) | |||
} | |||
return nil, err |
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.
We do not seem to return a proper gRPC status code in similar code paths either, so I copied the pattern. Not sure if good or not, my expectation/hope would be that gRPC maps this to a generic "internal error" or similar.
@adamwg you may know this one better than me.
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.
I believe the go gRPC framework wraps non-gRPC errors from RPC handlers using the Unknown
status code. I always prefer to return explicit gRPC errors with appropriate codes from handlers, but gRPC is OK with it either way.
Makes sense to follow the general pattern here, and if we want to return explicit Internal
s everywhere we can do that in a separate PR.
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.
Makes sense to me -- will keep that in mind for a follow up PR.
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.
Are there any unit tests that cover this code? If so, it would be nice to add a test case to catch this.
I added |
7c2708e
to
ed1d4c3
Compare
We previously continued processing when fetching the snapshot failed for errors other than 404.
ed1d4c3
to
8e89fc3
Compare
We previously continued processing when fetching the snapshot failed for errors other than 404.