Skip to content
This repository has been archived by the owner on Jul 15, 2022. It is now read-only.

Error handling + action fix #1298

Merged
merged 1 commit into from
Jul 12, 2021
Merged

Error handling + action fix #1298

merged 1 commit into from
Jul 12, 2021

Conversation

juan-cortes
Copy link
Contributor

@juan-cortes juan-cortes commented Jul 8, 2021

WARNING: This is marked as a draft because we are pending the backend's deployment of the latest version which will handle these new errors. For now, it's coded blindly relying on the specs.

This pr prepares to handle the error cases that might arise when interacting with the swap feature with the new provider. Due to the limitations, we have in the KYC form, the error handling is at a generic level and not per field. It also includes a reset mechanism (and disabling of the form) based on a specific error for unauthorized rates for the specified user.

This needs to be tested once all the pieces are in place.

It also includes a fix for the requireLatestFirmware mod we introduced, ironically I only made it work for all flows except swap. Thanks @LFBarreto for helping find this bug, I was not passing the flag to the nested connectApp inside initSwap.

Update

Tested against the latest deployed staging, the error handling is as good as we can make it currently. If you are adventurous and want to try it before it gets merged, yalc this version on LLD, and replace your valid ID for wyre in the app.json file with something invalid, for instance, turn your "US_123456" into "_US_123456" and refresh the app. It should let you reach the form but throw the unauthorized error later.

@juan-cortes juan-cortes requested a review from a team July 8, 2021 14:42
@vercel
Copy link

vercel bot commented Jul 8, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/ledgerhq/ledger-live-common/ANc58FVSU3NqFAg5AiNDStFDLpvy
✅ Preview: https://ledger-live-common-git-fork-juan-cortes-wyre-kyc-ledgerhq.vercel.app

@codecov
Copy link

codecov bot commented Jul 8, 2021

Codecov Report

Merging #1298 (c501659) into master (6dbe445) will decrease coverage by 3.61%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1298      +/-   ##
==========================================
- Coverage   66.55%   62.94%   -3.62%     
==========================================
  Files         363      342      -21     
  Lines       15358    13788    -1570     
  Branches     4596     4232     -364     
==========================================
- Hits        10222     8679    -1543     
+ Misses       4373     4295      -78     
- Partials      763      814      +51     
Impacted Files Coverage Δ
src/errors.js 100.00% <100.00%> (ø)
src/families/bitcoin/libcore-broadcast.js 0.00% <0.00%> (-100.00%) ⬇️
src/families/bitcoin/libcore-signOperation.js 0.00% <0.00%> (-97.44%) ⬇️
src/apps/support.js 6.25% <0.00%> (-93.75%) ⬇️
src/libcore/signOperation.js 6.25% <0.00%> (-90.63%) ⬇️
src/families/algorand/libcore-buildOperation.js 6.89% <0.00%> (-89.66%) ⬇️
src/libcore/broadcast.js 16.66% <0.00%> (-83.34%) ⬇️
src/families/algorand/libcore-postBuildAccount.js 16.66% <0.00%> (-83.34%) ⬇️
src/families/stellar/js-signOperation.js 6.89% <0.00%> (-82.76%) ⬇️
src/families/ethereum/signOperation.js 1.75% <0.00%> (-82.46%) ⬇️
... and 63 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6dbe445...c501659. Read the comment docs.

@juan-cortes juan-cortes marked this pull request as ready for review July 9, 2021 09:37
@gre gre merged commit b3bb0c4 into LedgerHQ:master Jul 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants