]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Wrap UDP tracker response error
authorMatt Joiner <anacrolix@gmail.com>
Mon, 22 Nov 2021 21:32:25 +0000 (08:32 +1100)
committerMatt Joiner <anacrolix@gmail.com>
Mon, 22 Nov 2021 21:32:25 +0000 (08:32 +1100)
tracker/udp/client.go

index dc67a9001fd43aec5bc915f1acd1832b042d5627..c7f9392d36a7bab7df6d09719e2bc1a35ba54e88 100644 (file)
@@ -4,7 +4,6 @@ import (
        "bytes"
        "context"
        "encoding/binary"
-       "errors"
        "fmt"
        "io"
        "net"
@@ -165,7 +164,7 @@ func (cl *Client) request(ctx context.Context, action Action, body []byte) (resp
                        respBody = dr.Body
                        addr = dr.Addr
                } else if dr.Header.Action == ActionError {
-                       err = errors.New(string(dr.Body))
+                       err = fmt.Errorf("error response: %s", dr.Body)
                } else {
                        err = fmt.Errorf("unexpected response action %v", dr.Header.Action)
                }