From: Matt Joiner Date: Sat, 20 Feb 2016 03:40:28 +0000 (+1100) Subject: Use new error handling philosophy X-Git-Tag: v1.0.0~878 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=f76d86da4f12f53f09017d85acfebd93da0c802d;p=btrtrc.git Use new error handling philosophy --- diff --git a/client.go b/client.go index 0dc753ab..b96cbd5f 100644 --- a/client.go +++ b/client.go @@ -1361,11 +1361,11 @@ func (me *Client) sendChunk(t *torrent, c *connection, r request) error { tp.waitNoPendingWrites() p := t.Info.Piece(int(r.Index)) n, err := dataReadAt(t.data, b, p.Offset()+int64(r.Begin)) - if err != nil { - return err - } if n != len(b) { - log.Fatal(b) + if err == nil { + panic("expected error") + } + return err } c.Post(pp.Message{ Type: pp.Piece,