Skip to content

Commit

Permalink
Update Get and GetRevision error handling
Browse files Browse the repository at this point in the history
Signed-off-by: Matthew DeVenny <matt@boxboat.com>
  • Loading branch information
matthewdevenny committed Feb 10, 2022
1 parent b0bdce2 commit 14145b0
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions kv.go
Expand Up @@ -373,10 +373,10 @@ func keyValid(key string) bool {
// Get returns the latest value for the key.
func (kv *kvs) Get(key string) (KeyValueEntry, error) {
e, err := kv.get(key, kvLatestRevision)
if err == ErrKeyDeleted {
return nil, ErrKeyNotFound
}
if err != nil {
if err == ErrKeyDeleted {
return nil, ErrKeyNotFound
}
return nil, err
}

Expand All @@ -386,10 +386,10 @@ func (kv *kvs) Get(key string) (KeyValueEntry, error) {
// GetRevision returns a specific revision value for the key.
func (kv *kvs) GetRevision(key string, revision uint64) (KeyValueEntry, error) {
e, err := kv.get(key, revision)
if err == ErrKeyDeleted {
return nil, ErrKeyNotFound
}
if err != nil {
if err == ErrKeyDeleted {
return nil, ErrKeyNotFound
}
return nil, err
}

Expand Down

0 comments on commit 14145b0

Please sign in to comment.