Skip to content

Commit

Permalink
blob: ReadTo/Write from should return the original err (#2735)
Browse files Browse the repository at this point in the history
Allows the caller to detect the error type instead of returning a
formatted string
  • Loading branch information
Petr Tichý committed Jan 31, 2020
1 parent 88e0487 commit d780487
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions blob/blob.go
Expand Up @@ -163,15 +163,15 @@ func readFromWriteTo(r io.Reader, w io.Writer) (int64, int64, error) {
numWritten, werr := w.Write(buf[0:numRead])
totalWritten += int64(numWritten)
if werr != nil {
return totalRead, totalWritten, fmt.Errorf("failed to write: %v", werr)
return totalRead, totalWritten, werr
}
}
if rerr == io.EOF {
// Done!
return totalRead, totalWritten, nil
}
if rerr != nil {
return totalRead, totalWritten, fmt.Errorf("failed to read: %v", rerr)
return totalRead, totalWritten, rerr
}
}
}
Expand Down

0 comments on commit d780487

Please sign in to comment.