mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
internal/ethapi: able to returns bytes of the custom errors
This commit is contained in:
parent
064f37d6f6
commit
0f7056fc56
1 changed files with 2 additions and 0 deletions
|
|
@ -49,6 +49,8 @@ func newRevertError(revert []byte) *revertError {
|
||||||
reason, errUnpack := abi.UnpackRevert(revert)
|
reason, errUnpack := abi.UnpackRevert(revert)
|
||||||
if errUnpack == nil {
|
if errUnpack == nil {
|
||||||
err = fmt.Errorf("%w: %v", vm.ErrExecutionReverted, reason)
|
err = fmt.Errorf("%w: %v", vm.ErrExecutionReverted, reason)
|
||||||
|
} else if len(revert) >= 4 {
|
||||||
|
err = fmt.Errorf("execution reverted with a custom error: %x", revert)
|
||||||
}
|
}
|
||||||
return &revertError{
|
return &revertError{
|
||||||
error: err,
|
error: err,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue