Promise rejection is handled differently than in the browser
Closed this issue · 1 comments
tian000 commented
Describe the bug
In the browser, promise rejection in the callback causes the request
method to reject. In node (this library), it results in an uncaught exception.
To Reproduce
Run this in the browser
await navigator.locks.request("test-key", async () => {throw new Error("stuff")}).catch(err => console.log("PROMISE REJECTED", err));
Run this in node
await locks.request("test-key", async () => {throw new Error("stuff")}).catch(err => console.log("PROMISE REJECTED", err));
Notice that we get a console log in the browser, but not in node.
Expected behavior
We should match the browser implementation.
tshemsedinov commented
Thanks! Fixed here: #55