Skip to content

Commit a57f74b

Browse files
committed
Make initial key getting error more verbose
1 parent a5ce342 commit a57f74b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

internal/client/http.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"crypto/tls"
66
"encoding/hex"
77
"errors"
8+
"fmt"
89
"io"
910
"log"
1011
mathrand "math/rand"
@@ -63,12 +64,12 @@ func NewHTTPConn(address string, connector func() (net.Conn, error)) (*HTTPConn,
6364

6465
resp, err := result.client.Head(address + "/push?key=" + hex.EncodeToString(publicKeyBytes))
6566
if err != nil {
66-
return nil, err
67+
return nil, fmt.Errorf("failed to connect to %s/push?key=%s, err: %s", address, hex.EncodeToString(publicKeyBytes), err)
6768
}
6869
resp.Body.Close()
6970

7071
if resp.StatusCode != http.StatusTemporaryRedirect {
71-
return nil, errors.New("server refused to open a session for us")
72+
return nil, fmt.Errorf("server refused to open a session for us: expected %d got %d", http.StatusTemporaryRedirect, resp.StatusCode)
7273
}
7374

7475
found := false

0 commit comments

Comments
 (0)