From 0b077d6fdac0e57b05c6031a3c936c2bbc4696a3 Mon Sep 17 00:00:00 2001 From: softsimon Date: Sat, 4 Sep 2021 01:32:36 +0400 Subject: [PATCH] Handle string error messages. fixes #763 --- backend/src/api/bitcoin/electrum-api.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/src/api/bitcoin/electrum-api.ts b/backend/src/api/bitcoin/electrum-api.ts index 8de667222..38597c0cf 100644 --- a/backend/src/api/bitcoin/electrum-api.ts +++ b/backend/src/api/bitcoin/electrum-api.ts @@ -93,7 +93,7 @@ class BitcoindElectrsApi extends BitcoinApi implements AbstractBitcoinApi { if (e === 'failed to get confirmed status') { e = 'The number of transactions on this address exceeds the Electrum server limit'; } - throw new Error(e instanceof Error ? e.message : 'Error'); + throw new Error(typeof e === 'string' ? e : 'Error'); } } @@ -131,7 +131,7 @@ class BitcoindElectrsApi extends BitcoinApi implements AbstractBitcoinApi { if (e === 'failed to get confirmed status') { e = 'The number of transactions on this address exceeds the Electrum server limit'; } - throw new Error(e instanceof Error ? e.message : 'Error'); + throw new Error(typeof e === 'string' ? e : 'Error'); } }