Commit b5957350 authored by Juan Batiz-Benet's avatar Juan Batiz-Benet
Browse files

remove debugerrors

We now consider debugerrors harmful: we've run into cases where
debugerror.Wrap() hid valuable error information (err == io.EOF?).
I've removed them from the main code, but left them in some tests.
Go errors are lacking, but unfortunately, this isn't the solution.

It is possible that debugerros.New or debugerrors.Errorf should
remain still (i.e. only remove debugerrors.Wrap) but we don't use
these errors often enough to keep.
parent 044af691
...@@ -15,7 +15,6 @@ import ( ...@@ -15,7 +15,6 @@ import (
addrutil "github.com/ipfs/go-ipfs/p2p/net/swarm/addr" addrutil "github.com/ipfs/go-ipfs/p2p/net/swarm/addr"
peer "github.com/ipfs/go-ipfs/p2p/peer" peer "github.com/ipfs/go-ipfs/p2p/peer"
debugerror "github.com/ipfs/go-ipfs/util/debugerror"
) )
// String returns the string rep of d. // String returns the string rep of d.
...@@ -107,7 +106,7 @@ func (d *Dialer) rawConnDial(ctx context.Context, raddr ma.Multiaddr, remote pee ...@@ -107,7 +106,7 @@ func (d *Dialer) rawConnDial(ctx context.Context, raddr ma.Multiaddr, remote pee
if strings.HasPrefix(raddr.String(), "/ip4/0.0.0.0") { if strings.HasPrefix(raddr.String(), "/ip4/0.0.0.0") {
log.Event(ctx, "connDialZeroAddr", lgbl.Dial("conn", d.LocalPeer, remote, nil, raddr)) log.Event(ctx, "connDialZeroAddr", lgbl.Dial("conn", d.LocalPeer, remote, nil, raddr))
return nil, debugerror.Errorf("Attempted to connect to zero address: %s", raddr) return nil, fmt.Errorf("Attempted to connect to zero address: %s", raddr)
} }
// get local addr to use. // get local addr to use.
......
package conn package conn
import ( import (
"errors"
"net" "net"
"time" "time"
...@@ -11,7 +12,6 @@ import ( ...@@ -11,7 +12,6 @@ import (
ic "github.com/ipfs/go-ipfs/p2p/crypto" ic "github.com/ipfs/go-ipfs/p2p/crypto"
secio "github.com/ipfs/go-ipfs/p2p/crypto/secio" secio "github.com/ipfs/go-ipfs/p2p/crypto/secio"
peer "github.com/ipfs/go-ipfs/p2p/peer" peer "github.com/ipfs/go-ipfs/p2p/peer"
errors "github.com/ipfs/go-ipfs/util/debugerror"
) )
// secureConn wraps another Conn object with an encrypted channel. // secureConn wraps another Conn object with an encrypted channel.
......
...@@ -2,6 +2,7 @@ package swarm ...@@ -2,6 +2,7 @@ package swarm
import ( import (
"bytes" "bytes"
"fmt"
"io" "io"
"sync" "sync"
"testing" "testing"
...@@ -10,7 +11,6 @@ import ( ...@@ -10,7 +11,6 @@ import (
metrics "github.com/ipfs/go-ipfs/metrics" metrics "github.com/ipfs/go-ipfs/metrics"
inet "github.com/ipfs/go-ipfs/p2p/net" inet "github.com/ipfs/go-ipfs/p2p/net"
peer "github.com/ipfs/go-ipfs/p2p/peer" peer "github.com/ipfs/go-ipfs/p2p/peer"
errors "github.com/ipfs/go-ipfs/util/debugerror"
testutil "github.com/ipfs/go-ipfs/util/testutil" testutil "github.com/ipfs/go-ipfs/util/testutil"
ma "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-multiaddr" ma "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-multiaddr"
...@@ -130,7 +130,7 @@ func SubtestSwarm(t *testing.T, SwarmNum int, MsgNum int) { ...@@ -130,7 +130,7 @@ func SubtestSwarm(t *testing.T, SwarmNum int, MsgNum int) {
// first, one stream per peer (nice) // first, one stream per peer (nice)
stream, err := s1.NewStreamWithPeer(p) stream, err := s1.NewStreamWithPeer(p)
if err != nil { if err != nil {
errChan <- errors.Wrap(err) errChan <- err
return return
} }
...@@ -177,12 +177,12 @@ func SubtestSwarm(t *testing.T, SwarmNum int, MsgNum int) { ...@@ -177,12 +177,12 @@ func SubtestSwarm(t *testing.T, SwarmNum int, MsgNum int) {
// read from the stream // read from the stream
if _, err := stream.Read(msg); err != nil { if _, err := stream.Read(msg); err != nil {
errChan <- errors.Wrap(err) errChan <- err
continue continue
} }
if string(msg) != "pong" { if string(msg) != "pong" {
errChan <- errors.Errorf("unexpected message: %s", msg) errChan <- fmt.Errorf("unexpected message: %s", msg)
continue continue
} }
...@@ -195,7 +195,7 @@ func SubtestSwarm(t *testing.T, SwarmNum int, MsgNum int) { ...@@ -195,7 +195,7 @@ func SubtestSwarm(t *testing.T, SwarmNum int, MsgNum int) {
} }
if count != countShouldBe { if count != countShouldBe {
errChan <- errors.Errorf("count mismatch: %d != %d", count, countShouldBe) errChan <- fmt.Errorf("count mismatch: %d != %d", count, countShouldBe)
} }
}() }()
......
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