Skip to content

Commit

Permalink
(SHIP-2626) added custom error handling for Treasure (#13981)
Browse files Browse the repository at this point in the history
* added custom error handling for Treasure

* added changeset

* fix

* fixed test

* moved Treasure error to Fatal

* added treasure fatal

* fixed changeset

* add changeset

* removed extra changeset

* added fatal error case test

* changeset fix

* removed unsed fatal errors
  • Loading branch information
amaechiokolobi committed Aug 17, 2024
1 parent 69335dc commit 6ef1d6e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/strong-dogs-smash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chainlink": minor
---

error handling for Treasure #added
8 changes: 7 additions & 1 deletion core/chains/evm/client/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,12 @@ var arbitrum = ClientErrors{
ServiceUnavailable: regexp.MustCompile(`(: |^)502 Bad Gateway: [\s\S]*$|network is unreachable|i/o timeout`),
}

// Treasure
var treasureFatal = regexp.MustCompile(`(: |^)invalid chain id for signer(:|$)`)
var treasure = ClientErrors{
Fatal: treasureFatal,
}

var celo = ClientErrors{
TxFeeExceedsCap: regexp.MustCompile(`(: |^)tx fee \([0-9\.]+ of currency celo\) exceeds the configured cap \([0-9\.]+ [a-zA-Z]+\)$`),
TerminallyUnderpriced: regexp.MustCompile(`(: |^)gasprice is less than gas price minimum floor`),
Expand Down Expand Up @@ -270,7 +276,7 @@ var internal = ClientErrors{
TerminallyStuck: regexp.MustCompile(TerminallyStuckMsg),
}

var clients = []ClientErrors{parity, geth, arbitrum, metis, substrate, avalanche, nethermind, harmony, besu, erigon, klaytn, celo, zkSync, zkEvm, mantle, aStar, gnosis, internal}
var clients = []ClientErrors{parity, geth, arbitrum, metis, substrate, avalanche, nethermind, harmony, besu, erigon, klaytn, celo, zkSync, zkEvm, treasure, mantle, aStar, gnosis, internal}

// ClientErrorRegexes returns a map of compiled regexes for each error type
func ClientErrorRegexes(errsRegex config.ClientErrors) *ClientErrors {
Expand Down
1 change: 1 addition & 0 deletions core/chains/evm/client/errors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,7 @@ func Test_Eth_Errors_Fatal(t *testing.T) {
{"failed to forward tx to sequencer, please try again. Error message: 'invalid sender'", true, "Mantle"},

{"client error fatal", true, "tomlConfig"},
{"invalid chain id for signer", true, "Treasure"},
}

for _, test := range tests {
Expand Down

0 comments on commit 6ef1d6e

Please sign in to comment.