Skip to content

Commit

Permalink
Log context expired at info level while reading body
Browse files Browse the repository at this point in the history
  • Loading branch information
vansante committed Dec 17, 2019
1 parent 62f0ae9 commit f894156
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,11 @@ func (r *Reader) read(buf []byte, offset int64) (n int, err error) {

n, err = resp.Body.Read(buf)
if err != nil && err != io.EOF {
r.Errorf("Reader.read: Error reading http body for %s: %v", r.fileID, err)
if errors.Is(err, context.DeadlineExceeded) || errors.Is(err, context.Canceled) {
r.Infof("Reader.read: Context expired for %s: %v", r.fileID, err)
} else {
r.Errorf("Reader.read: Error reading http body for %s: %v", r.fileID, err)
}
return n, err
}
if n == 0 {
Expand Down

0 comments on commit f894156

Please # to comment.