From 3d55b517435507acc2dbd433481d7eafdeaf8ac8 Mon Sep 17 00:00:00 2001 From: Charlie Chen Date: Wed, 21 Aug 2024 13:06:54 -0500 Subject: [PATCH] unified RPC error alert message --- zetaclient/chains/bitcoin/rpc/rpc.go | 6 +++--- zetaclient/chains/evm/rpc/rpc.go | 6 +++--- zetaclient/chains/solana/rpc/rpc.go | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/zetaclient/chains/bitcoin/rpc/rpc.go b/zetaclient/chains/bitcoin/rpc/rpc.go index c2f73364d8..a265dc45f3 100644 --- a/zetaclient/chains/bitcoin/rpc/rpc.go +++ b/zetaclient/chains/bitcoin/rpc/rpc.go @@ -175,19 +175,19 @@ func CheckRPCStatus( // query latest block number bn, err := client.GetBlockCount() if err != nil { - return errors.Wrap(err, "GetBlockCount error: RPC down?") + return errors.Wrap(err, "RPC error onGetBlockCount: RPC down?") } // query latest block header hash, err := client.GetBlockHash(bn) if err != nil { - return errors.Wrap(err, "GetBlockHash error: RPC down?") + return errors.Wrap(err, "RPC error onGetBlockHash: RPC down?") } // query latest block header thru hash header, err := client.GetBlockHeader(hash) if err != nil { - return errors.Wrap(err, "GetBlockHeader error: RPC down?") + return errors.Wrap(err, "RPC error onGetBlockHeader: RPC down?") } // use default alert latency if not provided diff --git a/zetaclient/chains/evm/rpc/rpc.go b/zetaclient/chains/evm/rpc/rpc.go index 538392adae..22bea55110 100644 --- a/zetaclient/chains/evm/rpc/rpc.go +++ b/zetaclient/chains/evm/rpc/rpc.go @@ -70,19 +70,19 @@ func CheckRPCStatus( // query latest block number bn, err := client.BlockNumber(ctx) if err != nil { - return errors.Wrap(err, "BlockNumber error: RPC down?") + return errors.Wrap(err, "RPC error onBlockNumber: RPC down?") } // query suggested gas price gasPrice, err := client.SuggestGasPrice(ctx) if err != nil { - return errors.Wrap(err, "SuggestGasPrice error: RPC down?") + return errors.Wrap(err, "RPC error onSuggestGasPrice: RPC down?") } // query latest block header header, err := client.HeaderByNumber(ctx, new(big.Int).SetUint64(bn)) if err != nil { - return errors.Wrap(err, "HeaderByNumber error: RPC down?") + return errors.Wrap(err, "RPC error onHeaderByNumber: RPC down?") } // use default alert latency if not provided diff --git a/zetaclient/chains/solana/rpc/rpc.go b/zetaclient/chains/solana/rpc/rpc.go index c62bcccb06..c5cf6b0989 100644 --- a/zetaclient/chains/solana/rpc/rpc.go +++ b/zetaclient/chains/solana/rpc/rpc.go @@ -133,19 +133,19 @@ func CheckRPCStatus( // query solana health (always return "ok" unless --trusted-validator is provided) _, err := client.GetHealth(ctx) if err != nil { - return errors.Wrap(err, "GetHealth error: RPC down?") + return errors.Wrap(err, "RPC error onGetHealth: RPC down?") } // query latest slot slot, err := client.GetSlot(ctx, rpc.CommitmentFinalized) if err != nil { - return errors.Wrap(err, "GetSlot error: RPC down?") + return errors.Wrap(err, "RPC error onGetSlot: RPC down?") } // query latest block time blockTime, err := client.GetBlockTime(ctx, slot) if err != nil { - return errors.Wrap(err, "GetBlockTime error: RPC down?") + return errors.Wrap(err, "RPC error onGetBlockTime: RPC down?") } // use default alert latency if not provided