Skip to content

Commit

Permalink
ALL-1948 Extended JSON stringify to see error message of Load Balancer (
Browse files Browse the repository at this point in the history
  • Loading branch information
Hathoriel authored Jul 10, 2023
1 parent b158920 commit 77e0cf5
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 8 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/connector/tatum.connector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
4 changes: 2 additions & 2 deletions src/dto/Network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
8 changes: 4 additions & 4 deletions src/service/rpc/generic/LoadBalancerRpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.`,
Expand Down Expand Up @@ -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))}`)
}
}

Expand All @@ -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.`)
}
/**
Expand Down

0 comments on commit 77e0cf5

Please sign in to comment.