mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-01-06 05:25:40 +00:00
don't wrap io.EOF errors during gRPC streaming
Signed-off-by: Steve Kriss <krisss@vmware.com>
This commit is contained in:
@@ -112,6 +112,12 @@ func (c *ObjectStoreGRPCClient) GetObject(bucket, key string) (io.ReadCloser, er
|
||||
|
||||
receive := func() ([]byte, error) {
|
||||
data, err := stream.Recv()
|
||||
if err == io.EOF {
|
||||
// we need to return io.EOF errors unwrapped so that
|
||||
// calling code sees them as io.EOF and knows to stop
|
||||
// reading.
|
||||
return nil, err
|
||||
}
|
||||
if err != nil {
|
||||
return nil, fromGRPCError(err)
|
||||
}
|
||||
|
||||
@@ -101,6 +101,12 @@ func (s *ObjectStoreGRPCServer) PutObject(stream proto.ObjectStore_PutObjectServ
|
||||
}
|
||||
|
||||
data, err := stream.Recv()
|
||||
if err == io.EOF {
|
||||
// we need to return io.EOF errors unwrapped so that
|
||||
// calling code sees them as io.EOF and knows to stop
|
||||
// reading.
|
||||
return nil, err
|
||||
}
|
||||
if err != nil {
|
||||
return nil, errors.WithStack(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user