Skip to content

Commit 5086c1c

Browse files
authored
Merge pull request #1224 from davesque/exc-catching
Remove unnecessary exception catching
2 parents ca2e70a + 503564b commit 5086c1c

File tree

1 file changed

+15
-24
lines changed

1 file changed

+15
-24
lines changed

web3/_utils/contracts.py

Lines changed: 15 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
from eth_abi import (
44
encode_abi as eth_abi_encode_abi,
55
)
6-
from eth_abi.exceptions import (
7-
EncodingError,
8-
)
96
from eth_utils import (
107
add_0x_prefix,
118
encode_hex,
@@ -139,27 +136,21 @@ def encode_abi(web3, abi, arguments, data=None):
139136
)
140137
)
141138

142-
try:
143-
normalizers = [
144-
abi_ens_resolver(web3),
145-
abi_address_to_hex,
146-
abi_bytes_to_bytes,
147-
abi_string_to_text,
148-
]
149-
normalized_arguments = map_abi_data(
150-
normalizers,
151-
argument_types,
152-
arguments,
153-
)
154-
encoded_arguments = eth_abi_encode_abi(
155-
argument_types,
156-
normalized_arguments,
157-
)
158-
except EncodingError as e:
159-
raise TypeError(
160-
"One or more arguments could not be encoded to the necessary "
161-
"ABI type: {0}".format(str(e))
162-
)
139+
normalizers = [
140+
abi_ens_resolver(web3),
141+
abi_address_to_hex,
142+
abi_bytes_to_bytes,
143+
abi_string_to_text,
144+
]
145+
normalized_arguments = map_abi_data(
146+
normalizers,
147+
argument_types,
148+
arguments,
149+
)
150+
encoded_arguments = eth_abi_encode_abi(
151+
argument_types,
152+
normalized_arguments,
153+
)
163154

164155
if data:
165156
return to_hex(HexBytes(data) + encoded_arguments)

0 commit comments

Comments
 (0)