From 33a972afc650758fb29e4a78f5187e61e425d6df Mon Sep 17 00:00:00 2001 From: sairaj mote Date: Tue, 16 Jan 2024 15:12:02 +0530 Subject: [PATCH] added error handling for when historic price api fails --- index.html | 7 ++++-- index.min.html | 66 +++++++++++++++++++++++++------------------------- 2 files changed, 38 insertions(+), 35 deletions(-) diff --git a/index.html b/index.html index 83d7d1f..d80ba3f 100644 --- a/index.html +++ b/index.html @@ -634,7 +634,6 @@ }); btcOperator.checkIfTor() .then(isTor => { - console.log(isTor) if (isTor) historicPriceApis.list.push('http://omwkzk6bd6zuragdqsrhdyzgxzre7yx4vzrou4vzftintzc2dmagp6qd.onion:8257') }) @@ -1293,7 +1292,11 @@ historicPriceApis.active++ return getHistoricPrice(dates) } else { - throw err + selectedCurrency = 'btc' + showCurrentValue = false + localStorage.setItem('btc-wallet-currency', selectedCurrency) + localStorage.setItem('btc-wallet-show-current-value', showCurrentValue) + notify('There was an error fetching historic price data. Please try again later.', 'error') } } } diff --git a/index.min.html b/index.min.html index 8bfe562..dd49312 100644 --- a/index.min.html +++ b/index.min.html @@ -1,6 +1,6 @@ - Bitcoin Wallet
Getting Bitcoin Wallet ready
Bitcoin Web Wallet logo
RanchiMall

Bitcoin Wallet

BTC INR USD

Keep your keys safe!

Don't share with anyone. The private key cannot be recovered if lost.

Did you forget your BTC address?

If you have your private key, enter it here and recover your BTC address.

\ No newline at end of file + `),document.getElementById("new_fee").querySelector(".currency-symbol").innerHTML=currencyIcons[selectedCurrency],openPopup("increase_fee_popup")}catch(e){notify(e.message||e,"error")}finally{buttonLoader(r,!1)}}async function increaseFee(e=!1){buttonLoader(document.getElementById("increase_fee"),!0);const t=parseFloat((parseFloat(document.getElementById("new_fee").value.trim())/(globalExchangeRate[selectedCurrency]||1)).toFixed(8)),r=[];document.querySelectorAll(".increase-fee-sender").forEach((e=>{const t=e.querySelector(".sender__address").textContent.trim(),s=e.querySelector(".sender__private-key").value.trim();if(!btcOperator.verifyKey(t,s))return notify(`Invalid private key for address ${t}`,"error");s&&r.push(s)}));try{let s;s=e?await btcOperator.editFee_corewallet(changingFeeOf,t,r):await btcOperator.editFee(changingFeeOf,t,r),btcOperator.broadcastTx(s).then((e=>{console.log(e),closePopup(),showTransactionResult("success",e)})).catch((e=>{notify(e,"error")})).finally((e=>{buttonLoader(document.getElementById("increase_fee"),!1),changingFeeOf=null}))}catch(e){notify(e,"error"),buttonLoader(document.getElementById("increase_fee"),!1)}} \ No newline at end of file