Skip to content

Commit aeb070b

Browse files
committed
Fix string interpolation issues in exception message.
Fixes an issue preventing a meaningful message from being extracted from the result data due to the HexBytes object being printed rather than the bytes which includes the message.
1 parent d722f31 commit aeb070b

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

newsfragments/2096.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Hot fix for string interpolation issue with contract function call decoding exception to facilitate extracting a meaningful message from the eth_call response

web3/contract.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1524,8 +1524,9 @@ def call_contract_function(
15241524
)
15251525
else:
15261526
msg = (
1527-
f"Could not decode contract function call {function_identifier} "
1528-
f"return data {return_data!r} for output_types {output_types}"
1527+
f"Could not decode contract function call to '{function_identifier}'.\n"
1528+
f"return data: {return_data}\n"
1529+
f"output_types: {output_types}"
15291530
)
15301531
raise BadFunctionCallOutput(msg) from e
15311532

0 commit comments

Comments
 (0)