Skip to content

Commit

Permalink
fix: promise leak by capturing rejection from getVersion (#584)
Browse files Browse the repository at this point in the history
* fix: promise leak by capturing rejection from getVersion

* chore: add semicolon in the end of instruction
  • Loading branch information
alexruzenhack authored Oct 31, 2023
1 parent 29ca737 commit 217797f
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 217797f

Please sign in to comment.