Skip to content

Commit 24dab7a

Browse files
committed
[fix](network): Implement error handling for the case when a block does not exist
1 parent c3e5b5c commit 24dab7a

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/network.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,10 +168,14 @@ impl<'a> Network<'a> {
168168
.filter_map(|receipt| receipt.as_ref().ok().and_then(|receipt| receipt.clone()))
169169
.collect::<Vec<_>>();
170170

171-
Ok(Some(BlockWithTransactionReceipts {
172-
block: block.unwrap(), //TODO
173-
transaction_receipts: Some(transaction_receipts),
174-
}))
171+
if let Some(block) = block {
172+
Ok(Some(BlockWithTransactionReceipts {
173+
block,
174+
transaction_receipts: Some(transaction_receipts),
175+
}))
176+
} else {
177+
Ok(None)
178+
}
175179
}
176180

177181
//TODO: use `join`

0 commit comments

Comments
 (0)