Skip to content
This repository has been archived by the owner on May 11, 2024. It is now read-only.

Commit

Permalink
handle real error
Browse files Browse the repository at this point in the history
  • Loading branch information
mask-pp committed Apr 23, 2024
1 parent e314feb commit 4ff9f25
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion bindings/encoding/custom_error.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package encoding

import (
"errors"
"github.com/ethereum/go-ethereum/common"
"strings"
)

Expand All @@ -22,7 +23,8 @@ func TryParsingCustomError(originalError error) error {

for _, customErrors := range customErrorMaps {
for _, customError := range customErrors {
if strings.HasPrefix(customError.ID.Hex(), errData) || strings.Contains(errData, customError.Name) {
if strings.Contains(errData, common.Bytes2Hex(customError.ID[:4])) ||
strings.Contains(errData, customError.Name) {
return errors.New(customError.Name)
}
}
Expand Down

0 comments on commit 4ff9f25

Please sign in to comment.