Skip to content

Commit 6fa55e9

Browse files
committed
wip
1 parent 0b6b63b commit 6fa55e9

File tree

4 files changed

+25
-8
lines changed

4 files changed

+25
-8
lines changed

docs/v6_migration.rst

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,21 @@ Here are the most common required updates:
1212
Web3.py does not raise ValueError nor AttributeError instances anymore
1313
----------------------------------------------------------------------
1414

15-
In v5, some Web3.py exceptions inherited from ValueError or AttributeError.
15+
In v5, some Web3.py exceptions inherited from AttributeError, namely:
16+
17+
- NoABIFunctionsFound
18+
- NoABIFound
19+
- NoABIEventsFound
20+
21+
Others inherited from ValueError, namely:
22+
23+
- InvalidAddress
24+
- NameNotFound
25+
- LogTopicError
26+
- InvalidEventABI
27+
1628
Now Web3.py exceptions now inherit from the same base Web3Exception.
29+
30+
As such, any code that was expecting a ValueError or an AttributeError from
31+
Web3py must update to expecting one of the exception listed above, or
32+
Web3Exception.

tests/core/contracts/test_contract_call_interface.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
BlockNumberOutofRange,
2828
InvalidAddress,
2929
MismatchedABI,
30+
NameNotFound,
3031
NoABIFound,
3132
NoABIFunctionsFound,
3233
ValidationError,
@@ -468,7 +469,7 @@ def test_call_address_reflector_name_array(address_reflector_contract, call):
468469

469470
def test_call_reject_invalid_ens_name(address_reflector_contract, call):
470471
with contract_ens_addresses(address_reflector_contract, []):
471-
with pytest.raises(ValueError):
472+
with pytest.raises(NameNotFound):
472473
call(contract=address_reflector_contract,
473474
contract_function='reflect',
474475
func_args=['type0.eth'])

tests/core/eth-module/test_eth_contract.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
)
99

1010
from web3.exceptions import (
11-
NameNotFound,
11+
InvalidAddress,
1212
)
1313

1414
ABI = [{}]
@@ -23,11 +23,11 @@
2323
(
2424
((ADDRESS,), {}, None),
2525
((BYTES_ADDRESS,), {}, None),
26-
((INVALID_CHECKSUM_ADDRESS,), {}, NameNotFound),
27-
((NON_CHECKSUM_ADDRESS,), {}, NameNotFound),
26+
((INVALID_CHECKSUM_ADDRESS,), {}, InvalidAddress),
27+
((NON_CHECKSUM_ADDRESS,), {}, InvalidAddress),
2828
((), {'address': ADDRESS}, None),
29-
((), {'address': INVALID_CHECKSUM_ADDRESS}, NameNotFound),
30-
((), {'address': NON_CHECKSUM_ADDRESS}, NameNotFound),
29+
((), {'address': INVALID_CHECKSUM_ADDRESS}, InvalidAddress),
30+
((), {'address': NON_CHECKSUM_ADDRESS}, InvalidAddress),
3131
)
3232
)
3333
def test_contract_address_validation(web3, args, kwargs, expected):

web3/exceptions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ class PMError(Web3Exception):
138138
pass
139139

140140

141-
class ManifestValidationError(Web3Exception):
141+
class ManifestValidationError(PMError):
142142
"""
143143
Raised when a provided manifest cannot be published, since it's invalid.
144144
"""

0 commit comments

Comments
 (0)