As mentioned previously, it is not a good practice to repeat code in a modern web application, so we can use many resources to avoid this practice. In Angular development, we can use a shared service to handle the application errors in just one place.
Dealing with the HttpErrorHandler service
Creating a handler error service
As mentioned earlier in this chapter, let's create our error handler service:
- Open your Terminal window inside ./Client/src/app and type the following command:
ng g service pages/shared/_services/httpHandleError
The previous command will create a new folder called _services inside the pages/shared folder for a simple reason: we will share this service between all services that we created inside...