mirror of
https://github.com/ipfs/kubo.git
synced 2025-06-30 18:13:54 +08:00
refactor(blockservice) export blockservice.ErrNotFound
This commit is contained in:
@ -1,6 +1,7 @@
|
|||||||
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 (
|
|||||||
)
|
)
|
||||||
|
|
||||||
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
|
|||||||
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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user