From 0c65321e17ceda11f8ade38cddb22487c63f577b Mon Sep 17 00:00:00 2001 From: Torresmorah Date: Tue, 29 Aug 2023 10:31:03 -0600 Subject: [PATCH] fix(webapp): catch the error when parsing of endpoints fails --- webapp/src/config/evm.config.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/webapp/src/config/evm.config.js b/webapp/src/config/evm.config.js index 972b2fde..b16e4c09 100644 --- a/webapp/src/config/evm.config.js +++ b/webapp/src/config/evm.config.js @@ -1,6 +1,7 @@ import { eosConfig } from 'config' let _avgBlockTime = 'N/A' +let _endpoints switch (eosConfig.networkName) { case 'telos-testnet': @@ -15,9 +16,16 @@ switch (eosConfig.networkName) { break } +try { + _endpoints = JSON.parse(process.env.REACT_APP_EVM_ENDPOINTS || '[]') || [] +} catch (error) { + console.error(error) + _endpoints = [] +} + export const avgBlockTime = _avgBlockTime export const maxTPSDataSize = 30 / _avgBlockTime || 0 export const account = 'eosio.evm' export const endpoint = process.env.REACT_APP_EVM_ENDPOINT export const blockExplorerUrl = process.env.REACT_APP_EVM_BLOCK_EXPLORER_URL -export const endpoints = JSON.parse(process.env.REACT_APP_EVM_ENDPOINTS || '[]') || [] +export const endpoints = _endpoints