Skip to content

Commit

Permalink
fixup! fix: publish 'error' message for failure after upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
turadg committed Feb 27, 2024
1 parent a5c0bbe commit 2b7c4e5
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions packages/smart-wallet/src/offerWatcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,12 @@ export const prepareOfferWatcher = baggage => {
facets.helper.updateStatus({ result: UNPUBLISHED_RESULT });
}
},
/** @param {Error} err */
/**
* Called when the offer result promise rejects. The other two watchers
* are waiting for particular values out of Zoe but they settle at the same time
* and don't need their own error handling.
* @param {Error} err
*/
handleError(err) {
const { facets } = this;
facets.helper.updateStatus({ error: err.toString() });
Expand All @@ -220,15 +225,14 @@ export const prepareOfferWatcher = baggage => {
facets.helper.updateStatus({ payouts: amounts });
},
/**
* If promise disconnected, watch again. Errors are handled by the resultWatcher.
* @param {Error | import('@agoric/internal/src/upgrade-api.js').UpgradeDisconnection} reason
* @param {UserSeat} seat
*/
onRejected(reason, seat) {
const { facets } = this;
if (isUpgradeDisconnection(reason)) {
void watchForPayout(facets, seat);
} else {
facets.helper.handleError(reason);
}
},
},
Expand All @@ -240,6 +244,8 @@ export const prepareOfferWatcher = baggage => {
facets.helper.publishResult(result);
},
/**
* If promise disconnected, watch again. Or if there's an Error, handle it.
*
* @param {Error | import('@agoric/internal/src/upgrade-api.js').UpgradeDisconnection} reason
* @param {UserSeat} seat
*/
Expand All @@ -261,15 +267,14 @@ export const prepareOfferWatcher = baggage => {
facets.helper.updateStatus({ numWantsSatisfied: numSatisfied });
},
/**
* If promise disconnected, watch again. Errors are handled by the resultWatcher.
* @param {Error | import('@agoric/internal/src/upgrade-api.js').UpgradeDisconnection} reason
* @param {UserSeat} seat
*/
onRejected(reason, seat) {
const { facets } = this;
if (isUpgradeDisconnection(reason)) {
void watchForNumWants(facets, seat);
} else {
facets.helper.handleError(reason);
}
},
},
Expand Down

0 comments on commit 2b7c4e5

Please sign in to comment.