Skip to content

Commit c0ccb3c

Browse files
committed
Correct gRPC error codes
Signed-off-by: Prasad Ghangal <[email protected]>
1 parent a06f79b commit c0ccb3c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pkg/hostpath/snapshotmetadataserver.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func (hp *hostPath) GetMetadataAllocated(req *csi.GetMetadataAllocatedRequest, s
4040
// Load snapshots
4141
source, err := hp.state.GetSnapshotByID(snapID)
4242
if err != nil {
43-
return status.Error(codes.Internal, "cannot find the snapshot")
43+
return status.Error(codes.NotFound, "cannot find the snapshot")
4444
}
4545
if !source.ReadyToUse {
4646
return status.Error(codes.Unavailable, fmt.Sprintf("snapshot %v is not yet ready to use", snapID))
@@ -116,11 +116,11 @@ func (hp *hostPath) GetMetadataDelta(req *csi.GetMetadataDeltaRequest, stream cs
116116
// Load snapshots
117117
source, err := hp.state.GetSnapshotByID(baseSnapID)
118118
if err != nil {
119-
return status.Error(codes.Internal, "cannot find the source snapshot")
119+
return status.Error(codes.NotFound, "cannot find the source snapshot")
120120
}
121121
target, err := hp.state.GetSnapshotByID(targetSnapID)
122122
if err != nil {
123-
return status.Error(codes.Internal, "cannot find the target snapshot")
123+
return status.Error(codes.NotFound, "cannot find the target snapshot")
124124
}
125125

126126
if !source.ReadyToUse {

0 commit comments

Comments
 (0)