From 77e0cf5adfb86b0dee7eb2e56abf2f6dd2de3e2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Kotol?= Date: Mon, 10 Jul 2023 13:52:16 +0200 Subject: [PATCH] ALL-1948 Extended JSON stringify to see error message of Load Balancer (#854) --- CHANGELOG.md | 4 ++++ package.json | 2 +- src/connector/tatum.connector.ts | 2 +- src/dto/Network.ts | 4 ++-- src/service/rpc/generic/LoadBalancerRpc.ts | 8 ++++---- 5 files changed, 12 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 02956e3d47..d08cf39cde 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## [1.5.7] - 2023.07.10 +### Changed +- Extended JSON stringify to see error message in case of error to Loadbalancer + ## [1.5.6] - 2023.07.10 ### Changed - Added JSON stringify to see error message in case of error to Loadbalancer diff --git a/package.json b/package.json index 0f00490f8e..caa7f25af9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@tatumcom/js", - "version": "1.5.6", + "version": "1.5.7", "description": "Tatum JS SDK", "author": "Tatum", "repository": "https://github.com/tatumio/tatum-js", diff --git a/src/connector/tatum.connector.ts b/src/connector/tatum.connector.ts index c12bf92142..fc13680561 100644 --- a/src/connector/tatum.connector.ts +++ b/src/connector/tatum.connector.ts @@ -78,7 +78,7 @@ export class TatumConnector { }) } catch (error) { if (verbose) { - console.warn(new Date().toISOString(), 'Error: ', JSON.stringify(error)) + console.warn(new Date().toISOString(), `Error: ${JSON.stringify(error, Object.getOwnPropertyNames(error))}`) } return Promise.reject(error) } diff --git a/src/dto/Network.ts b/src/dto/Network.ts index 17633ec177..aaf1b7dad0 100644 --- a/src/dto/Network.ts +++ b/src/dto/Network.ts @@ -188,8 +188,8 @@ export const EVM_LOAD_BALANCER_NETWORKS = [ Network.FLARE_SONGBIRD, Network.HAQQ, Network.HAQQ_TESTNET, - // Network.ETHEREUM, - // Network.ETHEREUM_SEPOLIA, + Network.ETHEREUM, + Network.ETHEREUM_SEPOLIA, ] export const LOAD_BALANCER_NETWORKS = [ diff --git a/src/service/rpc/generic/LoadBalancerRpc.ts b/src/service/rpc/generic/LoadBalancerRpc.ts index 5e02548188..bac110c755 100644 --- a/src/service/rpc/generic/LoadBalancerRpc.ts +++ b/src/service/rpc/generic/LoadBalancerRpc.ts @@ -149,11 +149,11 @@ export class LoadBalancerRpc implements AbstractRpcInterface { server.failed = false server.lastBlock = Utils.parseStatusPayload(network, response) } else { - Utils.log({ id: this.id, message: `Failed to check status of ${server.node.url}. Error: ${JSON.stringify(response)}`}) + Utils.log({ id: this.id, message: `Failed to check status of ${server.node.url}. Error: ${JSON.stringify(response, Object.getOwnPropertyNames(response))}`}) server.failed = true } }).catch((e) => { - Utils.log({ id: this.id, message: `Failed to check status of ${server.node.url}. Error: ${JSON.stringify(e)}` }) + Utils.log({ id: this.id, message: `Failed to check status of ${server.node.url}. Error: ${JSON.stringify(e, Object.getOwnPropertyNames(e))}` }) Utils.log({ id: this.id, message: `Server ${server.node.url} will be marked as failed and will be removed from the pool.`, @@ -266,7 +266,7 @@ export class LoadBalancerRpc implements AbstractRpcInterface { console.error(new Date().toISOString(), `Failed to fetch RPC configuration for ${network} blockchain`) } } catch (e) { - console.error(new Date().toISOString(), 'Failed to initialize RPC module', e) + console.error(new Date().toISOString(), `Failed to initialize RPC module. Error: ${JSON.stringify(e, Object.getOwnPropertyNames(e))}`) } } @@ -275,7 +275,7 @@ export class LoadBalancerRpc implements AbstractRpcInterface { const url = this.getActiveUrl(nodeType) const activeIndex = this.getActiveIndex(nodeType) if (verbose) { - console.warn(new Date().toISOString(), `Failed to call RPC ${Array.isArray(rpcCall) ? 'methods' : rpcCall.method} on ${url}.`, e) + console.warn(new Date().toISOString(), `Failed to call RPC ${Array.isArray(rpcCall) ? 'methods' : rpcCall.method} on ${url}. Error: ${JSON.stringify(e, Object.getOwnPropertyNames(e))}`) console.log(new Date().toISOString(), `Switching to another server, marking this as unstable.`) } /**