Skip to content

Commit

Permalink
feat: Return correct error in ForeignBlockStore::get_block
Browse files Browse the repository at this point in the history
  • Loading branch information
matheus23 committed Feb 15, 2024
1 parent df5b83a commit 3e2ae56
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions wnfs-wasm/src/fs/blockstore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ impl WnfsBlockStore for ForeignBlockStore {
.await
.map_err(anyhow_error("Cannot get block: {:?}"))?;

if value.is_undefined() {
return Err(BlockStoreError::CIDNotFound(*cid));
}

// Convert the value to a vector of bytes.
let bytes = Uint8Array::new(&value).to_vec();
Ok(Bytes::from(bytes))
Expand Down

0 comments on commit 3e2ae56

Please sign in to comment.