Is it possible to use `require` and custom errors together in the same contract?

Responsive Ad Header

Question

Grade: Education Subject: Support
Is it possible to use `require` and custom errors together in the same contract?
Asked by:
80 Viewed 80 Answers

Answer (80)

Best Answer
(264)
Yes, you can use both `require` and custom errors in the same contract. `require` can be used for simpler checks or when backward compatibility is needed, while custom errors are best suited for more complex error handling and providing detailed error information.