Merge pull request #776 from nodar-chkuaselidze/blockstore-minor
blockstore-test: use try/catch instead of promise.catch/finally.
This commit is contained in:
commit
c2c16e2dd3
@ -813,17 +813,20 @@ describe('BlockStore', function() {
|
|||||||
// Accidentally don't use `await` and attempt to
|
// Accidentally don't use `await` and attempt to
|
||||||
// write multiple blocks in parallel and at the
|
// write multiple blocks in parallel and at the
|
||||||
// same file position.
|
// same file position.
|
||||||
const promise = store.write(hash, block);
|
(async () => {
|
||||||
promise.catch((e) => {
|
try {
|
||||||
err = e;
|
await store.write(hash, block);
|
||||||
}).finally(() => {
|
} catch (e) {
|
||||||
finished += 1;
|
err = e;
|
||||||
if (finished >= 16) {
|
} finally {
|
||||||
assert(err);
|
finished += 1;
|
||||||
assert(err.message, 'Already writing.');
|
if (finished >= 16) {
|
||||||
done();
|
assert(err);
|
||||||
|
assert(err.message, 'Already writing.');
|
||||||
|
done();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
})();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user