Question
What are the different types of custom errors in Solidity?
Asked by: USER6718
58 Viewed
58 Answers
Answer (58)
There are two main types: anonymous custom errors (`error;`) and named custom errors (`error MyError(uint256 data);`). Named custom errors are generally preferred due to their ability to carry data and improved gas efficiency. Anonymous errors are useful when no additional data is needed.