Skip to content

Catch ABIEventNotFound for an undefined contract event - #94

Merged
mmlado merged 1 commit into
mainfrom
fix/abi-event-not-found
Oct 29, 2026
Merged

mmlado merged 1 commit into
mainfrom
fix/abi-event-not-found

Conversation

@mmlado

@mmlado mmlado commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • eth contract list_events with an event the contract's ABI does not define prints "The event is not defined" and returns 1, instead of stopping with AttributeError: module 'web3.exceptions' has no attribute 'ABIEventFunctionNotFound'.
  • The except clause catches web3.exceptions.ABIEventNotFound, the name web3 uses from 7.0 on; setup.cfg requires web3>=7.15.0.
  • Changelog entry under Unreleased / Fixed.

Test plan

  • Event.logs() for an undefined event, offline with a mocked config and endpoint and the bundled ERC-20 ABI, on web3 7.15.0 and 8.0.0: crashes on main, returns 1 with the message on this branch
  • flake8 clean; pylint 9.62, same as main

🤖 Generated with Claude Code

web3 7 renamed ABIEventFunctionNotFound to ABIEventNotFound, so
eth contract list_events with an event the ABI does not define
stopped with an AttributeError instead of saying so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mmlado
mmlado merged commit 22b7f38 into main Oct 29, 2026
17 checks passed
@mmlado
mmlado deleted the fix/abi-event-not-found branch October 29, 2026 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant