mirror of
https://github.com/status-im/nim-stew.git
synced 2025-02-10 03:04:33 +00:00
Normalise KeyError
exception message (#119)
This commit is contained in:
parent
c2f0cbf0d9
commit
b3ea2c6b46
@ -380,14 +380,12 @@ proc delete*[K,V](rq: var KeyedQueue[K,V]; key: K):
|
||||
## Delete the item with key `key` from the queue and returns the key-value
|
||||
## item pair just deleted (if any).
|
||||
if rq.tab.hasKey(key):
|
||||
try:
|
||||
noKeyError("delete"):
|
||||
let kvp = KeyedQueuePair[K,V](
|
||||
key: key,
|
||||
data: rq.tab[key].data)
|
||||
rq.deleteImpl(key)
|
||||
return ok(kvp)
|
||||
except KeyError:
|
||||
raiseAssert "We've checked that the key is present above"
|
||||
err()
|
||||
|
||||
proc del*[K,V](rq: var KeyedQueue[K,V]; key: K) =
|
||||
|
Loading…
x
Reference in New Issue
Block a user