From 5fd449e8657cac5a183b157592b95ffd1b478647 Mon Sep 17 00:00:00 2001 From: Bulat Ziganshin Date: Thu, 30 Jun 2022 15:37:52 +0300 Subject: [PATCH] DEBUG: check CacheStore.getBlock w/o catch --- codex/stores/cachestore.nim | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/codex/stores/cachestore.nim b/codex/stores/cachestore.nim index 8521ae5b..7ac6fa05 100644 --- a/codex/stores/cachestore.nim +++ b/codex/stores/cachestore.nim @@ -55,16 +55,10 @@ method getBlock*( trace "Empty block, ignoring" return cid.emptyBlock.success -# if cid notin self.cache: -# return Block.failure("Block not found") # TODO: return nil + if cid notin self.cache: + return Block.failure("Block not found") # TODO: return nil - try: - let x = self.cache[cid] - return x.success - except CatchableError as e: - return Block.failure(e) - -# return self.cache[cid].catch() + return self.cache[cid] method hasBlock*(self: CacheStore, cid: Cid): Future[?!bool] {.async.} = ## Check if the block exists in the blockstore