Posts

Featured post

Error Handling in Angular

Image
In Previous topic we have looked into configuration part and saw the use of APP_INITIALIZER. In this topic we will cover error handling in angular application. Error Handling is an important part of designing an angular application, if anything goes wrong javascript will throw errors. For Example: Say we call a variable and it doesn't exist. when a value is not of the expected type. or, some internal error in javascript. Apart from these some errors like null pointer exception, session expiration, or unauthorized user etc.. There are two types of error handling mechanism is angular: Server side errors. Client side errors. Server-Side-Errors ➤➤ Server-side errors or HTTP errors are throws when you send a HTTP request through HttpClient. So what happen here when ever there is a error HttpClient captures the error and wraps it in the generic HttpErrorResponse before passing to application. The error property of HttpErrorResponse contains error object. Catch Http Errors ➤➤ We can catc...