Skip to content

Commit

Permalink
WIP(wallet-tools): unhandled rejections???
Browse files Browse the repository at this point in the history
  • Loading branch information
dckc committed Jan 15, 2024
1 parent 618d7cb commit 5f1d37b
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions contract/test/wallet-tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ export const mockWalletFactory = (
return E(purse).withdraw(amt);
}),
);
// XXX throwing here is unhandled somehow.
const seat = await E(zoe).offer(invitation, proposal, pmts, offerArgs);
// console.log(address, offerSpec.id, 'got seat');
yield { updated: 'offerStatus', status: offerSpec };
Expand Down Expand Up @@ -166,11 +167,18 @@ export const seatLike = updates => {
payouts: makePromiseKit(),
};
(async () => {
for await (const update of updates) {
if (update.updated !== 'offerStatus') continue;
const { result, payouts } = update.status;
if ('result' in update.status) sync.result.resolve(result);
if ('payouts' in update.status) sync.payouts.resolve(payouts);
try {
// XXX an error here is somehow and unhandled rejection
for await (const update of updates) {
if (update.updated !== 'offerStatus') continue;
const { result, payouts } = update.status;
if ('result' in update.status) sync.result.resolve(result);
if ('payouts' in update.status) sync.payouts.resolve(payouts);
}
} catch (reason) {
sync.result.reject(reason);
sync.payouts.reject(reason);
throw reason;
}
})();
return harden({
Expand Down

0 comments on commit 5f1d37b

Please sign in to comment.