Skip to content

Commit

Permalink
changed ValueError -> ValidationError and updated corresponding test
Browse files Browse the repository at this point in the history
  • Loading branch information
voith committed Apr 10, 2018
1 parent 89d8503 commit 6228420
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion tests/core/eth-module/test_poa.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import pytest

from web3.exceptions import (
ValidationError,
)
from web3.middleware import (
construct_fixture_middleware,
geth_poa_middleware,
Expand All @@ -12,7 +15,7 @@ def test_long_extra_data(web3):
'eth_getBlockByNumber': {'extraData': '0x' + 'ff' * 33},
})
web3.middleware_stack.inject(return_block_with_long_extra_data, layer=0)
with pytest.raises(ValueError):
with pytest.raises(ValidationError):
web3.eth.getBlock('latest')


Expand Down
5 changes: 4 additions & 1 deletion web3/middleware/pythonic.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
HexBytes,
)

from web3.exceptions import (
ValidationError,
)
from web3.utils.encoding import (
hexstr_if_str,
to_hex,
Expand Down Expand Up @@ -70,7 +73,7 @@ def check_extradata_length(val, length):
return val
result = HexBytes(val)
if len(result) > length:
raise ValueError(
raise ValidationError(
"The field extraData: %r is %d bytes, but should be %d. "
"It is quite likely that you are connected to a POA chain. "
"Refer "
Expand Down

0 comments on commit 6228420

Please sign in to comment.