Handling Errors
- Simulate error by changing the url to invalid url
- Handle errors and give proper error messages to the user
- Types of errors: Unexpected and expected
Unexpected Errors
- Server is offline
- Network is down (eg invalid url)
- Unhandled expections (Bug)
Expected Errors
- Not Found: status code 404. eg record not found when deleted by some one
- Bad Request: status code 400. eg username already exist - if there is a problem with the data that the client sends to the server, the server is going to respond bad request.