Skip to content

Commit

Permalink
refactor: onRejected reason
Browse files Browse the repository at this point in the history
  • Loading branch information
turadg committed Feb 27, 2024
1 parent b71171a commit a5c0bbe
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions packages/smart-wallet/src/offerWatcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,15 +220,15 @@ export const prepareOfferWatcher = baggage => {
facets.helper.updateStatus({ payouts: amounts });
},
/**
* @param {Error} err
* @param {Error | import('@agoric/internal/src/upgrade-api.js').UpgradeDisconnection} reason
* @param {UserSeat} seat
*/
onRejected(err, seat) {
onRejected(reason, seat) {
const { facets } = this;
if (isUpgradeDisconnection(err)) {
if (isUpgradeDisconnection(reason)) {
void watchForPayout(facets, seat);
} else {
facets.helper.handleError(err);
facets.helper.handleError(reason);
}
},
},
Expand All @@ -240,15 +240,15 @@ export const prepareOfferWatcher = baggage => {
facets.helper.publishResult(result);
},
/**
* @param {Error} err
* @param {Error | import('@agoric/internal/src/upgrade-api.js').UpgradeDisconnection} reason
* @param {UserSeat} seat
*/
onRejected(err, seat) {
onRejected(reason, seat) {
const { facets } = this;
if (isUpgradeDisconnection(err)) {
if (isUpgradeDisconnection(reason)) {
void watchForOfferResult(facets, seat);
} else {
facets.helper.handleError(err);
facets.helper.handleError(reason);
}
},
},
Expand All @@ -261,15 +261,15 @@ export const prepareOfferWatcher = baggage => {
facets.helper.updateStatus({ numWantsSatisfied: numSatisfied });
},
/**
* @param {Error} err
* @param {Error | import('@agoric/internal/src/upgrade-api.js').UpgradeDisconnection} reason
* @param {UserSeat} seat
*/
onRejected(err, seat) {
onRejected(reason, seat) {
const { facets } = this;
if (isUpgradeDisconnection(err)) {
if (isUpgradeDisconnection(reason)) {
void watchForNumWants(facets, seat);
} else {
facets.helper.handleError(err);
facets.helper.handleError(reason);
}
},
},
Expand Down

0 comments on commit a5c0bbe

Please sign in to comment.