Commit fb661d5b authored by Juan Batiz-Benet's avatar Juan Batiz-Benet

routing: use debugerror

parent cf507327
...@@ -12,6 +12,7 @@ import ( ...@@ -12,6 +12,7 @@ import (
pb "github.com/jbenet/go-ipfs/routing/dht/pb" pb "github.com/jbenet/go-ipfs/routing/dht/pb"
kb "github.com/jbenet/go-ipfs/routing/kbucket" kb "github.com/jbenet/go-ipfs/routing/kbucket"
u "github.com/jbenet/go-ipfs/util" u "github.com/jbenet/go-ipfs/util"
errors "github.com/jbenet/go-ipfs/util/debugerror"
pset "github.com/jbenet/go-ipfs/util/peerset" pset "github.com/jbenet/go-ipfs/util/peerset"
) )
...@@ -77,7 +78,7 @@ func (dht *IpfsDHT) GetValue(ctx context.Context, key u.Key) ([]byte, error) { ...@@ -77,7 +78,7 @@ func (dht *IpfsDHT) GetValue(ctx context.Context, key u.Key) ([]byte, error) {
closest := dht.routingTable.NearestPeers(kb.ConvertKey(key), PoolSize) closest := dht.routingTable.NearestPeers(kb.ConvertKey(key), PoolSize)
if closest == nil || len(closest) == 0 { if closest == nil || len(closest) == 0 {
log.Warning("Got no peers back from routing table!") log.Warning("Got no peers back from routing table!")
return nil, kb.ErrLookupFailure return nil, errors.Wrap(kb.ErrLookupFailure)
} }
// setup the Query // setup the Query
...@@ -154,7 +155,7 @@ func (dht *IpfsDHT) FindProviders(ctx context.Context, key u.Key) ([]peer.PeerIn ...@@ -154,7 +155,7 @@ func (dht *IpfsDHT) FindProviders(ctx context.Context, key u.Key) ([]peer.PeerIn
func (dht *IpfsDHT) getClosestPeers(ctx context.Context, key u.Key) (<-chan peer.ID, error) { func (dht *IpfsDHT) getClosestPeers(ctx context.Context, key u.Key) (<-chan peer.ID, error) {
tablepeers := dht.routingTable.NearestPeers(kb.ConvertKey(key), AlphaValue) tablepeers := dht.routingTable.NearestPeers(kb.ConvertKey(key), AlphaValue)
if len(tablepeers) == 0 { if len(tablepeers) == 0 {
return nil, kb.ErrLookupFailure return nil, errors.Wrap(kb.ErrLookupFailure)
} }
out := make(chan peer.ID, KValue) out := make(chan peer.ID, KValue)
...@@ -299,7 +300,7 @@ func (dht *IpfsDHT) FindPeer(ctx context.Context, id peer.ID) (peer.PeerInfo, er ...@@ -299,7 +300,7 @@ func (dht *IpfsDHT) FindPeer(ctx context.Context, id peer.ID) (peer.PeerInfo, er
closest := dht.routingTable.NearestPeers(kb.ConvertPeerID(id), AlphaValue) closest := dht.routingTable.NearestPeers(kb.ConvertPeerID(id), AlphaValue)
if closest == nil || len(closest) == 0 { if closest == nil || len(closest) == 0 {
return peer.PeerInfo{}, kb.ErrLookupFailure return peer.PeerInfo{}, errors.Wrap(kb.ErrLookupFailure)
} }
// Sanity... // Sanity...
...@@ -356,7 +357,7 @@ func (dht *IpfsDHT) FindPeersConnectedToPeer(ctx context.Context, id peer.ID) (< ...@@ -356,7 +357,7 @@ func (dht *IpfsDHT) FindPeersConnectedToPeer(ctx context.Context, id peer.ID) (<
closest := dht.routingTable.NearestPeers(kb.ConvertPeerID(id), AlphaValue) closest := dht.routingTable.NearestPeers(kb.ConvertPeerID(id), AlphaValue)
if closest == nil || len(closest) == 0 { if closest == nil || len(closest) == 0 {
return nil, kb.ErrLookupFailure return nil, errors.Wrap(kb.ErrLookupFailure)
} }
// setup the Query // setup the Query
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment