From the course: Building Angular and ASP.NET Core Applications

Unlock the full course today

Join today to access over 24,800 courses taught by industry experts.

Handling errors in Angular

Handling errors in Angular

- [Instructor] We have implemented the core features of our app, but so far, we kind of assumed that everything will work as expected, and that is not the case all the time. So, what we need to do is that we need to take care of the errors as well. Like, what happens when something goes wrong, or when the users do not provide the necessary data? Let us go to our app, and see an example. So, let us say we want to add a new book. In here I'll not provide any data, even though it says that the title, author, and description fields are required. If I click Add, the API endpoint is going to return a successful response, so I have added nothing to my collection, which is just wrong. Now, let us close the app, and go and fix this issue in our web API. So, now we go inside the controllers, then BooksController, close the terminal, and scroll down to the AddBook method. Let us put the breaking point. And here we are going to add…

Contents