Skip to content

feat: catch and store async promise error#960

Merged
pedroferreira1 merged 4 commits intomasterfrom
feat/catch-async-promise-error
Oct 27, 2025
Merged

feat: catch and store async promise error#960
pedroferreira1 merged 4 commits intomasterfrom
feat/catch-async-promise-error

Conversation

@pedroferreira1
Copy link
Copy Markdown
Member

@pedroferreira1 pedroferreira1 commented Oct 27, 2025

Motivation

The renew token promises are not awaited directly, so if they fail before reaching the await, we get an unhandled promise. The snap code was crashing the request with this unhandled promise.

Using an empty catch for each promise would do just fine for the snap code to work but in the end we await the promise and have a try...catch block, which wouldn't work, if we didn't store the error that could have happened before the await.

Acceptance Criteria

  • Capture unhandled promise error in renew token promises.

@codecov
Copy link
Copy Markdown

codecov bot commented Oct 27, 2025

Codecov Report

❌ Patch coverage is 91.66667% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 84.76%. Comparing base (19bc636) to head (185f241).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
src/wallet/wallet.ts 91.66% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master     #960   +/-   ##
=======================================
  Coverage   84.76%   84.76%           
=======================================
  Files         112      112           
  Lines        8079     8088    +9     
  Branches     1731     1733    +2     
=======================================
+ Hits         6848     6856    +8     
- Misses       1203     1204    +1     
  Partials       28       28           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@pedroferreira1 pedroferreira1 self-assigned this Oct 27, 2025
@pedroferreira1 pedroferreira1 requested review from andreabadesso and tuliomir and removed request for andreabadesso October 27, 2025 21:24
@pedroferreira1 pedroferreira1 moved this from Todo to In Progress (Done) in Hathor Network Oct 27, 2025
tuliomir
tuliomir previously approved these changes Oct 27, 2025
const walletId = HathorWalletServiceWallet.getWalletIdFromXPub(xpub);
this.walletId = walletId;
renewPromise2 = this.validateAndRenewAuthToken(pinCode);
renewPromise2 = this.validateAndRenewAuthToken(pinCode).catch(err => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Use another name for this variable, as a parent has already declared err

Suggested change
renewPromise2 = this.validateAndRenewAuthToken(pinCode).catch(err => {
renewPromise2 = this.validateAndRenewAuthToken(pinCode).catch(renew2err => {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done 24e651c

andreabadesso
andreabadesso previously approved these changes Oct 27, 2025
@github-project-automation github-project-automation bot moved this from In Progress (Done) to In Review (WIP) in Hathor Network Oct 27, 2025
@pedroferreira1 pedroferreira1 dismissed stale reviews from andreabadesso and tuliomir via 185f241 October 27, 2025 21:35
@tuliomir tuliomir moved this from In Review (WIP) to In Review (Done) in Hathor Network Oct 27, 2025
@pedroferreira1 pedroferreira1 merged commit 46c89f4 into master Oct 27, 2025
5 checks passed
@github-project-automation github-project-automation bot moved this from In Review (Done) to Waiting to be deployed in Hathor Network Oct 27, 2025
@pedroferreira1 pedroferreira1 deleted the feat/catch-async-promise-error branch October 27, 2025 22:08
@pedroferreira1 pedroferreira1 moved this from Waiting to be deployed to Done in Hathor Network Oct 30, 2025
r4mmer added a commit that referenced this pull request Dec 11, 2025
…-policy

* origin/master: (31 commits)
  feat: fee token creation (#858)
  fix: checkAddressMine was crashing when called with an empty array (#977)
  feat: the nano amount field should accept 0
  Merge pull request #975 from HathorNetwork/chore/bump-v2.11.0
  feat: add nano execution logs API (#973)
  Refactor: Fullnode facade to Typescript (#972)
  Merge pull request #970 from HathorNetwork/chore/bump-v2.10.0
  fix: added missing tx proposal delete schema (#969)
  feat: add missing api calls for graphviz and nano (#967)
  Merge pull request #965 from HathorNetwork/feat/complete-token-info-object
  chore: bump package to v2.9.1 (#962)
  feat: catch and store async promise error (#960)
  chore: bump wallet lib to v2.9.0 (#958)
  tests: use core v0.67.0 docker image for the integration tests (#956)
  tests: update integration tests blueprints for the new core sdk (#954)
  fix: added a minimal accessData so methods that need storage don't crash (#955)
  feat: fee header (#951)
  feat: added read-only start (#950)
  fix: dont add metadata changed for voided txs (#948)
  test: Wallet Service infrastructure (#909)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants