enhance error message

This commit is contained in:
Rez 2025-03-23 09:42:09 +11:00
parent 0ced839a19
commit 5623a3533e
No known key found for this signature in database
2 changed files with 4 additions and 4 deletions

View file

@ -1141,7 +1141,7 @@ func TestCall(t *testing.T) {
blockOverrides: override.BlockOverrides{ blockOverrides: override.BlockOverrides{
BeaconRoot: &common.Hash{0, 1, 2}, BeaconRoot: &common.Hash{0, 1, 2},
}, },
expectErr: errors.New(`"beaconRoot" is not supported for this RPC method`), expectErr: errors.New(`block override "beaconRoot" is not supported for this RPC method`),
}, },
{ {
name: "unsupported block override withdrawals", name: "unsupported block override withdrawals",
@ -1150,7 +1150,7 @@ func TestCall(t *testing.T) {
blockOverrides: override.BlockOverrides{ blockOverrides: override.BlockOverrides{
Withdrawals: &types.Withdrawals{}, Withdrawals: &types.Withdrawals{},
}, },
expectErr: errors.New(`"withdrawals" is not supported for this RPC method`), expectErr: errors.New(`block override "withdrawals" is not supported for this RPC method`),
}, },
} }
for _, tc := range testSuite { for _, tc := range testSuite {

View file

@ -139,10 +139,10 @@ func (o *BlockOverrides) Apply(blockCtx *vm.BlockContext) error {
return nil return nil
} }
if o.BeaconRoot != nil { if o.BeaconRoot != nil {
return errors.New(`"beaconRoot" is not supported for this RPC method`) return errors.New(`block override "beaconRoot" is not supported for this RPC method`)
} }
if o.Withdrawals != nil { if o.Withdrawals != nil {
return errors.New(`"withdrawals" is not supported for this RPC method`) return errors.New(`block override "withdrawals" is not supported for this RPC method`)
} }
if o.Number != nil { if o.Number != nil {
blockCtx.BlockNumber = o.Number.ToInt() blockCtx.BlockNumber = o.Number.ToInt()