keep-network / tbtc-dapp

Deposit BTC and redeem TBTC
http://dapp.test.tbtc.network/
MIT License
33 stars 31 forks source link

Catch moar errors #357

Closed ironng closed 3 years ago

ironng commented 3 years ago

This adds error handling to the deposit restoreState saga. Before https://github.com/keep-network/tbtc.js/pull/89, an UTXO error would occur occasionally and not sometimes not surface to the UI. This was due to the error arising during the restoreState saga in the finalCalls logic, which was not wrapped in any try/catch blocks.

In addition to adding error handling to restoreState, this removes the finalCalls logic and moves that to the onStateRestored saga.

Any error caused by state restoration is now tracked in the redux state and is shown either in the <Loadable> component or any relevant view that is wrapped in <Loadable>. We pass the error to the child views, because the view is revealed before the restoreState saga totally completes.