-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
Events are meant to be used to update the user view when relevant state changes happen.
When using events to signal errors in transaction setup, this is a waste of gas and don't give proper user feedback until the transaction is minted (of course it can be mitigated by checking before, but the checks are made more difficult with errors as events).
Examples:
| emit NotEnoughToken(votes[i].community, votes[i].voter); |
| event AlreadyVoted(bytes community, address voter); |
Instead, error handling should be used https://docs.soliditylang.org/en/v0.8.20/control-structures.html#error-handling-assert-require-revert-and-exceptions
When a error is thrown, the DApp can detect and handle the error, before the transaction is submitted.
Metadata
Metadata
Assignees
Labels
No labels