1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-09-10 05:52:20 +08:00

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.
This commit is contained in:
Juan Batiz-Benet
2015-04-20 00:15:34 -07:00
parent b483fdc948
commit 140cd1fd1b
30 changed files with 80 additions and 81 deletions

View File

@ -14,7 +14,6 @@ import (
peer "github.com/ipfs/go-ipfs/p2p/peer"
fsrepo "github.com/ipfs/go-ipfs/repo/fsrepo"
util "github.com/ipfs/go-ipfs/util"
"github.com/ipfs/go-ipfs/util/debugerror"
)
const (
@ -56,7 +55,7 @@ in the network, use 0.0.0.0 as the ip address:
ipfs config Addresses.Gateway /ip4/0.0.0.0/tcp/8080
Be careful if you expose the API. It is a security risk, as anyone could use control
Be careful if you expose the API. It is a security risk, as anyone could use control
your node remotely. If you need to control the node remotely, make sure to protect
the port as you would other services or database (firewall, authenticated proxy, etc).`,
},
@ -98,7 +97,7 @@ func daemonFunc(req cmds.Request, res cmds.Response) {
if !util.FileExists(req.Context().ConfigRoot) {
err := initWithDefaults(os.Stdout, req.Context().ConfigRoot)
if err != nil {
res.SetError(debugerror.Wrap(err), cmds.ErrNormal)
res.SetError(err, cmds.ErrNormal)
return
}
}
@ -120,7 +119,7 @@ func daemonFunc(req cmds.Request, res cmds.Response) {
// sure we are permitted to access the resources (datastore, etc.)
repo, err := fsrepo.Open(req.Context().ConfigRoot)
if err != nil {
res.SetError(debugerror.Errorf("Couldn't obtain lock. Is another daemon already running?"), cmds.ErrNormal)
res.SetError(fmt.Errorf("Couldn't obtain lock. Is another daemon already running?"), cmds.ErrNormal)
return
}