Raise KeyError when key not found

This commit is contained in:
Yuriy Glukhov 2018-08-14 12:13:30 +03:00 committed by zah
parent f91bb16bdd
commit 55b5dbd719
2 changed files with 1 additions and 3 deletions

View File

@ -72,8 +72,6 @@ proc get*(db: ChainDB, key: openarray[byte]): seq[byte] =
resSeq = newSeq[byte](resLen)
copyMem(resSeq.baseAddr, resStart, resLen)
return resSeq
of SQLITE_DONE:
return @[]
else: raiseKeySearchError(key)
proc put*(db: ChainDB, key, value: openarray[byte]) =

View File

@ -73,7 +73,7 @@ template raiseKeyWriteError*(key: auto) =
raise newException(StorageError, "failed to write key " & $key)
template raiseKeySearchError*(key: auto) =
raise newException(StorageError, "failure during search for key " & $key)
raise newException(KeyError, "failure during search for key " & $key)
template raiseKeyDeletionError*(key: auto) =
raise newException(StorageError, "failure to delete key " & $key)