Raise KeyError when key not found
This commit is contained in:
parent
f91bb16bdd
commit
55b5dbd719
|
@ -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]) =
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue