Working with data is not that easy. Sometimes, a failure might occur because of bad data, too many requests, or even an internet connection. But, as a developer, you need to make sure that your apps run smoothly in any case. In this video, learn how to handle errors in a React app.
- [Instructor] The way we have built our app so far … assumes that our code is perfect and it will always work … but any developer can tell you that is never the case. … So, let us learn how to handle errors in React. … For that, let's go to Visual Code and see the action. … In here, we are going to start from the API, … so let's go to the Controller. … So, I'll choose Controller … and in here, I'll just assume … that something will go wrong with the GetTrips. … Now, to handle that case in here, … we need to put all the code inside the API endpoint GetTrips … inside a try-catch block. … So, I'll just write in here try … and then we write in here catch … and then Exception to catch any type of exception, … and add ex. … And then we want to put all the logic … inside the try block. … And in the catch, … you're now going to return a BadRequest in this case. … And in the catch block, I'll just return a BadRequest. … So I'll just write in here, something went wrong, … or we can just return the ex.Message …
- Setting up the app infrastructure
- Creating data models
- Creating, reading, updating, and deleting API endpoints
- Testing API endpoints using Postman
- Reading data from React
- Adding new data from React
- Handling errors
- Implementing Redux in an existing React app
- Implementing authentication in your React app
Skill Level Intermediate
Managing App Secrets in .NET Corewith Ervis Trupja28m 15s Intermediate
1. Setting Up the App Infrastructure
2. Setting Up Web API
3. Getting Started with React
4. Implementing Redux to an Existing React App
5. Implementing Authentication in Your React App
Where to go next44s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.