[#348] replication: return errors if .Send rpc returns a nil SendRes

discovered while developing the next commit in this series
This commit is contained in:
Christian Schwarz
2020-07-26 12:22:59 +02:00
parent fa586b493c
commit 43495d70c7

View File

@ -550,7 +550,12 @@ func (s *Step) updateSizeEstimate(ctx context.Context) error {
log.WithError(err).Error("dry run send request failed")
return err
}
s.expectedSize = sres.ExpectedSize
if sres == nil {
err := fmt.Errorf("dry run send request returned nil send result")
log.Error(err.Error())
return err
}
s.expectedSize = sres.GetExpectedSize()
return nil
}
@ -581,6 +586,11 @@ func (s *Step) doReplication(ctx context.Context) error {
log.WithError(err).Error("send request failed")
return err
}
if sres == nil {
err := fmt.Errorf("send request returned nil send result")
log.Error(err.Error())
return err
}
if stream == nil {
err := errors.New("send request did not return a stream, broken endpoint implementation")
return err