Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: better error handling when parsing events #8

Merged
merged 5 commits into from
Jul 29, 2024

Conversation

nvtaveras
Copy link
Contributor

This is an improvement over the way events were being parsed in #4, mainly introducing a way to distinguish events by checking their signature on the log topics, so that we can be sure the right ABI is being used when decoding the event, eliminating the unnecessary try/catch blocks in the previous implementation. I also added a few asserts in places that shouldn't be reachable unless there's a wrong assumption in the way events are being parsed.

@nvtaveras nvtaveras merged commit c37b08d into main Jul 29, 2024
1 check passed
@nvtaveras nvtaveras deleted the refactor/betterErrorHandling branch July 29, 2024 12:45
block: Number(receipt.blockNumber),
event,
txHash: log.transactionHash,
if (isProposalCreatedEvent(event)) {
Copy link
Collaborator

@chapati23 chapati23 Aug 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a case when this can fail silently that we should handle explicilty? i.e. there's no else block for when this event fails the type guard

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.

2 participants