Commit 3a0bbe2a authored by Juan Batiz-Benet's avatar Juan Batiz-Benet

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

refactor(blockservice, merkledag, namesys) deprecate u.ErrNotFound
parents cee1e9cc 9a9dc926
package blockservice package blockservice
import ( import (
"errors"
"fmt" "fmt"
context "github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/go.net/context" context "github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/go.net/context"
...@@ -13,6 +14,7 @@ import ( ...@@ -13,6 +14,7 @@ import (
) )
var log = u.Logger("blockservice") var log = u.Logger("blockservice")
var ErrNotFound = errors.New("blockservice: key not found")
// BlockService is a block datastore. // BlockService is a block datastore.
// It uses an internal `datastore.Datastore` instance to store values. // 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 ...@@ -73,7 +75,7 @@ func (s *BlockService) GetBlock(ctx context.Context, k u.Key) (*blocks.Block, er
return blk, nil return blk, nil
} else { } else {
log.Debug("Blockservice GetBlock: Not found.") log.Debug("Blockservice GetBlock: Not found.")
return nil, u.ErrNotFound return nil, ErrNotFound
} }
} }
......
...@@ -13,6 +13,7 @@ import ( ...@@ -13,6 +13,7 @@ import (
) )
var log = u.Logger("merkledag") var log = u.Logger("merkledag")
var ErrNotFound = fmt.Errorf("merkledag: not found")
// NodeMap maps u.Keys to Nodes. // NodeMap maps u.Keys to Nodes.
// We cannot use []byte/Multihash for keys :( // We cannot use []byte/Multihash for keys :(
...@@ -103,7 +104,7 @@ func (n *Node) RemoveNodeLink(name string) error { ...@@ -103,7 +104,7 @@ func (n *Node) RemoveNodeLink(name string) error {
return nil return nil
} }
} }
return u.ErrNotFound return ErrNotFound
} }
// Copy returns a copy of the node. // Copy returns a copy of the node.
......
...@@ -6,8 +6,6 @@ import ( ...@@ -6,8 +6,6 @@ import (
b58 "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-base58" 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" 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" 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 // DNSResolver implements a Resolver on DNS domains
...@@ -44,5 +42,5 @@ func (r *DNSResolver) Resolve(name string) (string, error) { ...@@ -44,5 +42,5 @@ func (r *DNSResolver) Resolve(name string) (string, error) {
return t, nil return t, nil
} }
return "", u.ErrNotFound return "", ErrResolveFailed
} }
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