Skip to content

Commit

Permalink
fix: promise leak by capturing rejection from axios
Browse files Browse the repository at this point in the history
  • Loading branch information
alexruzenhack committed Oct 26, 2023
1 parent 29ca737 commit 447c8d0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/new/wallet.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,8 @@ class HathorWallet extends EventEmitter {
* @inner
**/
async getVersionData() {
const versionData = await new Promise(resolve => {
versionApi.getVersion(resolve)
const versionData = await new Promise((resolve, reject)=> {
versionApi.getVersion(resolve).catch((error) => reject(error))
});

return {
Expand Down Expand Up @@ -1312,8 +1312,8 @@ class HathorWallet extends EventEmitter {
this.walletStopped = false;
this.setState(HathorWallet.CONNECTING);

const info = await new Promise(resolve => {
versionApi.getVersion(resolve);
const info = await new Promise((resolve , reject)=> {
versionApi.getVersion(resolve).catch((error) => reject(error));
});
if (info.network.indexOf(this.conn.network) >= 0) {
this.storage.setApiVersion(info);
Expand Down

0 comments on commit 447c8d0

Please sign in to comment.