Skip to content

Commit

Permalink
minor: revise panic messages
Browse files Browse the repository at this point in the history
  • Loading branch information
vbauerster committed Dec 31, 2023
1 parent cab1ee7 commit 33abadb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions part.go
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ func (p *Part) download(client *http.Client, req *http.Request, timeout, sleep t
switch err {
case io.EOF:
if n != 0 {
panic("expected no bytes were read at EOF")
panic(fmt.Sprintf("%d bytes were read after EOF", n))
}
continue
case io.ErrUnexpectedEOF:
Expand Down Expand Up @@ -347,12 +347,12 @@ func (p *Part) download(client *http.Client, req *http.Request, timeout, sleep t
p.dlogger.Println("Part is done")
return false, nil
} else {
panic("expected part to be done after EOF")
panic("part isn't done after EOF")
}
}

if p.isDone() {
panic(fmt.Sprintf("expected EOF after part is done, got: %v", err))
panic(fmt.Sprintf("part is done before EOF: %v", err))
}

return p.ctx.Err() == nil, err
Expand Down

0 comments on commit 33abadb

Please sign in to comment.