Introduction
Custom error types help you give more details about problems in your program. They make it easier to understand and fix errors.
When you want to add extra information to an error, like a code or description.
When you need to check the type of error to handle it differently.
When you want to group related errors together with specific details.