Skip to content

Commit 30b2b24

Browse files
fix: handle exception when uploading chunk fails
1 parent 51e247a commit 30b2b24

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,14 @@ Chunk.hashFunction = (data: Uint8Array): Uint8Array => {
6161

6262
const tree = new MerkleTree(async chunk => {
6363
await queue.enqueue(async () => {
64+
try {
6465
const envelope = stamper.stamp(chunk);
6566
await bee.uploadChunk(envelope, chunk.build());
6667
stampings++;
68+
} catch (err) {
69+
error({ err }, 'Failed to upload chunk');
70+
throw err; // Re-throw to make sure the queue knows this task failed
71+
}
6772
})
6873
})
6974

0 commit comments

Comments
 (0)