blockstore-test: use try/catch instead of promise.catch/finally.
finally was introduce in node v10, so this test will fail on v8.6.0 node.
This commit is contained in:
parent
4c49b088f0
commit
1fceb14e32
@ -813,17 +813,20 @@ describe('BlockStore', function() {
|
||||
// Accidentally don't use `await` and attempt to
|
||||
// write multiple blocks in parallel and at the
|
||||
// same file position.
|
||||
const promise = store.write(hash, block);
|
||||
promise.catch((e) => {
|
||||
err = e;
|
||||
}).finally(() => {
|
||||
finished += 1;
|
||||
if (finished >= 16) {
|
||||
assert(err);
|
||||
assert(err.message, 'Already writing.');
|
||||
done();
|
||||
(async () => {
|
||||
try {
|
||||
await store.write(hash, block);
|
||||
} catch (e) {
|
||||
err = e;
|
||||
} finally {
|
||||
finished += 1;
|
||||
if (finished >= 16) {
|
||||
assert(err);
|
||||
assert(err.message, 'Already writing.');
|
||||
done();
|
||||
}
|
||||
}
|
||||
});
|
||||
})();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user