Skip to content

Commit

Permalink
fix: more explicit error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
samsiegart committed Jun 21, 2023
1 parent 9c22de4 commit e781d6f
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions wallet/src/util/WalletBackendAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ export const makeWalletBridgeFromFollowers = (
},
err => {
console.error('error watching beansOwing', err);
errorHandler(new Error(err));
},
),
);
Expand Down Expand Up @@ -278,7 +279,12 @@ export const makeWalletBridgeFromFollowers = (

const watchBank = async () => {
if (isHalted) return;
bank = await queryBankBalances(keplrConnection.address, rpc);
try {
bank = await queryBankBalances(keplrConnection.address, rpc);
} catch (e) {
errorHandler(e);
return;
}
possiblyUpdateBankPurses();
setTimeout(watchBank, POLL_INTERVAL_MS);
};
Expand All @@ -291,6 +297,10 @@ export const makeWalletBridgeFromFollowers = (
vbankAssets = value;
possiblyUpdateBankPurses();
},
err => {
console.error('error watching vbank assets', err);
errorHandler(new Error(err));
},
),
);
};
Expand Down Expand Up @@ -326,6 +336,10 @@ export const makeWalletBridgeFromFollowers = (
value.liveOffers ?? [],
);
},
err => {
console.error('error watching pending offers', err);
errorHandler(err);
},
),
);
};
Expand Down Expand Up @@ -430,7 +444,8 @@ export const makeWalletBridgeFromFollowers = (
}
};

const loadData = () => fetchCurrent().then(followLatest);
const loadData = () =>
fetchCurrent().then(height => followLatest(height).catch(errorHandler));

const retry = () => {
loadData().catch(e => {
Expand Down

0 comments on commit e781d6f

Please sign in to comment.