Whenever an application becomes more complex and includes third-party frameworks, all kinds of error types need to be taken care of consistently without having a condition for each one. For example, a web service's large range of possible errors can bubble up to the handler where they need to be translated into HTTP codes with informative messages. These expected errors can range from parser errors to invalid authentication details, failed database connections, or an application-specific error with an error code. In this recipe, we'll cover how to deal with this variety of errors using wrappers.
Handling multiple errors
How to do it...
Let's create an error wrapper in a few steps:
- Open the project you created...