diff --git a/backend/src/api/bitcoin/electrum-api.ts b/backend/src/api/bitcoin/electrum-api.ts index 0ebadd3ef..d6f2e1df8 100644 --- a/backend/src/api/bitcoin/electrum-api.ts +++ b/backend/src/api/bitcoin/electrum-api.ts @@ -87,11 +87,8 @@ class BitcoindElectrsApi extends BitcoinApi implements AbstractBitcoinApi { }, 'electrum': true, }; - } catch (e) { - if (e === 'failed to get confirmed status') { - e = 'The number of transactions on this address exceeds the Electrum server limit'; - } - throw new Error(typeof e === 'string' ? e : 'Error'); + } catch (e: any) { + throw new Error(typeof e === 'string' ? e : e && e.message || e); } } @@ -124,12 +121,9 @@ class BitcoindElectrsApi extends BitcoinApi implements AbstractBitcoinApi { } return transactions; - } catch (e) { + } catch (e: any) { loadingIndicators.setProgress('address-' + address, 100); - if (e === 'failed to get confirmed status') { - e = 'The number of transactions on this address exceeds the Electrum server limit'; - } - throw new Error(typeof e === 'string' ? e : 'Error'); + throw new Error(typeof e === 'string' ? e : e && e.message || e); } } diff --git a/backend/src/routes.ts b/backend/src/routes.ts index 2836bb5b8..420f37fee 100644 --- a/backend/src/routes.ts +++ b/backend/src/routes.ts @@ -613,7 +613,7 @@ class Routes { const addressData = await bitcoinApi.$getAddress(req.params.address); res.json(addressData); } catch (e) { - if (e instanceof Error && e.message && e.message.indexOf('exceeds') > 0) { + if (e instanceof Error && e.message && (e.message.indexOf('too long') > 0 || e.message.indexOf('confirmed status') > 0)) { return res.status(413).send(e instanceof Error ? e.message : e); } res.status(500).send(e instanceof Error ? e.message : e); @@ -630,7 +630,7 @@ class Routes { const transactions = await bitcoinApi.$getAddressTransactions(req.params.address, req.params.txId); res.json(transactions); } catch (e) { - if (e instanceof Error && e.message && e.message.indexOf('exceeds') > 0) { + if (e instanceof Error && e.message && (e.message.indexOf('too long') > 0 || e.message.indexOf('confirmed status') > 0)) { return res.status(413).send(e instanceof Error ? e.message : e); } res.status(500).send(e instanceof Error ? e.message : e); diff --git a/frontend/src/app/components/address/address.component.html b/frontend/src/app/components/address/address.component.html index 07115fd4c..8162cf6e5 100644 --- a/frontend/src/app/components/address/address.component.html +++ b/frontend/src/app/components/address/address.component.html @@ -122,10 +122,11 @@ +
Error loading address data.
- {{ error.error }} + ({{ error.error }}) The number of transactions on this address exceeds the Electrum server limit @@ -136,6 +137,8 @@ https://mempool.space/address/{{ addressString }}
http://mempoolhqx4isw62xs7abwphsq7ldayuidyx2v2oethdhhj6mlo2r6ad.onion/address/{{ addressString }} +

+ ({{ error.error }})