Skip to content

Commit

Permalink
Merge pull request #224 from jbenet/issue-209-plus
Browse files Browse the repository at this point in the history
refactor(blockservice, merkledag, namesys) deprecate u.ErrNotFound
  • Loading branch information
jbenet committed Oct 28, 2014
2 parents cee1e9c + 9a9dc92 commit 3a0bbe2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
4 changes: 3 additions & 1 deletion blockservice/blockservice.go
@@ -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"
Expand All @@ -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.
Expand Down Expand Up @@ -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
}
}

Expand Down
3 changes: 2 additions & 1 deletion merkledag/merkledag.go
Expand Up @@ -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 :(
Expand Down Expand Up @@ -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.
Expand Down
4 changes: 1 addition & 3 deletions namesys/dns.go
Expand Up @@ -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
Expand Down Expand Up @@ -44,5 +42,5 @@ func (r *DNSResolver) Resolve(name string) (string, error) {
return t, nil
}

return "", u.ErrNotFound
return "", ErrResolveFailed
}

0 comments on commit 3a0bbe2

Please sign in to comment.