Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(blockservice, merkledag, namesys) deprecate u.ErrNotFound #224

Merged
merged 6 commits into from
Oct 28, 2014
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion blockservice/blockservice.go
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion merkledag/merkledag.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func (n *Node) RemoveNodeLink(name string) error {
return nil
}
}
return u.ErrNotFound
return fmt.Errorf("merkledag: %s not found", name)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make it a static error so we can check against it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

after your last commits this is not a static error yet. it should be so we can compare

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mistake. one moment

}

// Copy returns a copy of the node.
Expand Down
5 changes: 2 additions & 3 deletions namesys/dns.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
package namesys

import (
"fmt"
"net"

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 +43,5 @@ func (r *DNSResolver) Resolve(name string) (string, error) {
return t, nil
}

return "", u.ErrNotFound
return "", fmt.Errorf("namesys: %v not found", name)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here, static.

}