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 (
addrutil "github.com/ipfs/go-ipfs/p2p/net/swarm/addr"
peer "github.com/ipfs/go-ipfs/p2p/peer"
debugerror "github.com/ipfs/go-ipfs/util/debugerror"
)
// String returns the string rep of d.
......@@ -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") {
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.
......
package conn
import (
"errors"
"net"
"time"
......@@ -11,7 +12,6 @@ import (
ic "github.com/ipfs/go-ipfs/p2p/crypto"
secio "github.com/ipfs/go-ipfs/p2p/crypto/secio"
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.
......
......@@ -2,6 +2,7 @@ package swarm
import (
"bytes"
"fmt"
"io"
"sync"
"testing"
......@@ -10,7 +11,6 @@ import (
metrics "github.com/ipfs/go-ipfs/metrics"
inet "github.com/ipfs/go-ipfs/p2p/net"
peer "github.com/ipfs/go-ipfs/p2p/peer"
errors "github.com/ipfs/go-ipfs/util/debugerror"
testutil "github.com/ipfs/go-ipfs/util/testutil"
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) {
// first, one stream per peer (nice)
stream, err := s1.NewStreamWithPeer(p)
if err != nil {
errChan <- errors.Wrap(err)
errChan <- err
return
}
......@@ -177,12 +177,12 @@ func SubtestSwarm(t *testing.T, SwarmNum int, MsgNum int) {
// read from the stream
if _, err := stream.Read(msg); err != nil {
errChan <- errors.Wrap(err)
errChan <- err
continue
}
if string(msg) != "pong" {
errChan <- errors.Errorf("unexpected message: %s", msg)
errChan <- fmt.Errorf("unexpected message: %s", msg)
continue
}
......@@ -195,7 +195,7 @@ func SubtestSwarm(t *testing.T, SwarmNum int, MsgNum int) {
}
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