1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-06-30 09:59:13 +08:00

Merge pull request #224 from jbenet/issue-209-plus

refactor(blockservice, merkledag, namesys) deprecate u.ErrNotFound
This commit is contained in:
Juan Batiz-Benet
2014-10-28 16:11:52 -07:00
3 changed files with 6 additions and 5 deletions

View File

@ -1,6 +1,7 @@
package blockservice
import (
"errors"
"fmt"
context "github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/go.net/context"
@ -13,6 +14,7 @@ import (
)
var log = u.Logger("blockservice")
var ErrNotFound = errors.New("blockservice: key not found")
// BlockService is a block datastore.
// It uses an internal `datastore.Datastore` instance to store values.
@ -73,7 +75,7 @@ func (s *BlockService) GetBlock(ctx context.Context, k u.Key) (*blocks.Block, er
return blk, nil
} else {
log.Debug("Blockservice GetBlock: Not found.")
return nil, u.ErrNotFound
return nil, ErrNotFound
}
}

View File

@ -13,6 +13,7 @@ import (
)
var log = u.Logger("merkledag")
var ErrNotFound = fmt.Errorf("merkledag: not found")
// NodeMap maps u.Keys to Nodes.
// We cannot use []byte/Multihash for keys :(
@ -103,7 +104,7 @@ func (n *Node) RemoveNodeLink(name string) error {
return nil
}
}
return u.ErrNotFound
return ErrNotFound
}
// Copy returns a copy of the node.

View File

@ -6,8 +6,6 @@ import (
b58 "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-base58"
isd "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-is-domain"
mh "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-multihash"
u "github.com/jbenet/go-ipfs/util"
)
// DNSResolver implements a Resolver on DNS domains
@ -44,5 +42,5 @@ func (r *DNSResolver) Resolve(name string) (string, error) {
return t, nil
}
return "", u.ErrNotFound
return "", ErrResolveFailed
}