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 44aecd1 commit 17cd7f0
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions packages/smart-wallet/src/offerWatcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,15 +227,15 @@ export const prepareOfferWatcher = baggage => {
/**
* If promise disconnected, watch again. Or if there's an Error, handle it.
*
* @param {Error} err
* @param {Error | import('@agoric/internal/src/upgrade-api.js').DisconnectionObject} 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 @@ -249,15 +249,15 @@ export const prepareOfferWatcher = baggage => {
/**
* If promise disconnected, watch again. Or if there's an Error, handle it.
*
* @param {Error} err
* @param {Error | import('@agoric/internal/src/upgrade-api.js').DisconnectionObject} 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 @@ -276,12 +276,12 @@ export const prepareOfferWatcher = baggage => {
* and getPayouts() settle the same (they await the same promise and
* then synchronously return a local value).
*
* @param {Error} err
* @param {Error | import('@agoric/internal/src/upgrade-api.js').DisconnectionObject} reason
* @param {UserSeat} seat
*/
onRejected(err, seat) {
onRejected(reason, seat) {
const { facets } = this;
if (isUpgradeDisconnection(err)) {
if (isUpgradeDisconnection(reason)) {
void watchForNumWants(facets, seat);
}
},
Expand Down

0 comments on commit 17cd7f0

Please sign in to comment.