diff --git a/codex/stores/networkstore.nim b/codex/stores/networkstore.nim index 82a1428d..c035f5bd 100644 --- a/codex/stores/networkstore.nim +++ b/codex/stores/networkstore.nim @@ -37,13 +37,16 @@ type method getBlock*(self: NetworkStore, address: BlockAddress): Future[?!Block] {.async.} = trace "Getting block from local store or network", address - without blk =? await self.localStore.getBlock(address), error: - if not (error of BlockNotFoundError): return failure error - trace "Block not in local store", address + without blk =? (await self.localStore.getBlock(address)), err: + if not (err of BlockNotFoundError): + trace "Error getting block from local store", address, err = err.msg + return failure err - without newBlock =? (await self.engine.requestBlock(address)).catch, error: - trace "Unable to get block from exchange engine", address - return failure error + trace "Block not in local store", address, err = err.msg + + without newBlock =? (await self.engine.requestBlock(address)), err: + trace "Unable to get block from exchange engine", address, err = err.msg + return failure err return success newBlock