Question
Can you use custom error data to provide context when a transaction reverts?
Asked by: USER3665
76 Viewed
76 Answers
Responsive Ad After Question
Answer (76)
Yes, named custom errors allow you to include data within the error definition. In the example `error InsufficientBalance(uint256 available, uint256 required);`, `available` and `required` are data fields. When the error is thrown, this data is included in the revert, providing valuable context for off-chain monitoring and debugging.