@cryptotaxi247 / kubo / commits / 93cf2bb17

style(net/conn) fmt -> debugerror

License: MIT Signed-off-by: Brian Tiger Chow <brian@perfmode.com>

Brian Tiger Chow committed Nov 20, 2014 at 16:14 UTC 93cf2bb17678c724fdedfe19ff350051d73a35ae
1 file changed +5 -5
net/conn/dial.go
+5 -5
@@ -1,7 +1,6 @@
1 package conn
2
3 import (
4 - "fmt"
4 "strings"
5
6 context "github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/go.net/context"
@@ -10,6 +9,7 @@ import (
9 manet "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-multiaddr-net"
10
11 peer "github.com/jbenet/go-ipfs/peer"
12 + debugerror "github.com/jbenet/go-ipfs/util/debugerror"
13 )
14
15 // Dial connects to a particular peer, over a given network
@@ -17,7 +17,7 @@ import (
17 func (d *Dialer) Dial(ctx context.Context, network string, remote peer.Peer) (Conn, error) {
18 raddr := remote.NetAddress(network)
19 if raddr == nil {
20 - return nil, fmt.Errorf("No remote address for network %s", network)
20 + return nil, debugerror.Errorf("No remote address for network %s", network)
21 }
22 return d.DialAddr(ctx, raddr, remote)
23 }
@@ -34,7 +34,7 @@ func (d *Dialer) DialAddr(ctx context.Context, raddr ma.Multiaddr, remote peer.P
34 }
35 }
36 if !found {
37 - return nil, fmt.Errorf("address %s is not in peer %s", raddr, remote)
37 + return nil, debugerror.Errorf("address %s is not in peer %s", raddr, remote)
38 }
39
40 network, _, err := manet.DialArgs(raddr)
@@ -44,11 +44,11 @@ func (d *Dialer) DialAddr(ctx context.Context, raddr ma.Multiaddr, remote peer.P
44
45 laddr := d.LocalPeer.NetAddress(network)
46 if laddr == nil {
47 - return nil, fmt.Errorf("No local address for network %s", network)
47 + return nil, debugerror.Errorf("No local address for network %s", network)
48 }
49
50 if strings.HasPrefix(raddr.String(), "/ip4/0.0.0.0") {
51 - return nil, fmt.Errorf("Attempted to connect to zero address: %s", raddr)
51 + return nil, debugerror.Errorf("Attempted to connect to zero address: %s", raddr)
52 }
53
54 remote.SetType(peer.Remote)