From d4a2384a5ec32100ec0c5e81f3cb326a510002f9 Mon Sep 17 00:00:00 2001 From: Justin Starry Date: Sun, 29 Sep 2019 13:14:18 -0400 Subject: [PATCH] fix: graceful fallback when minimum balance request fails (#497) --- web3.js/src/connection.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/web3.js/src/connection.js b/web3.js/src/connection.js index 02b4d12e41a3bd..5ab4387b27b4ac 100644 --- a/web3.js/src/connection.js +++ b/web3.js/src/connection.js @@ -699,7 +699,8 @@ export class Connection { ); const res = GetMinimumBalanceForRentExemptionRpcResult(unsafeRes); if (res.error) { - throw new Error(res.error.message); + console.warn("Unable to fetch minimum balance for rent exemption"); + return 0; } assert(typeof res.result !== 'undefined'); return Number(res.result);