Exception Handling I
Learn how to throw an exception of a custom type.
We'll cover the following
When the client sends a request to fetch, update or delete a player record not found in the database, an internal server error occurs. The information contained in the response is verbose and of interest to developers only.
We will learn how to send a client-friendly JSON response when a player record is not found. The message can contain the error code, time when the error occurred, and information about why the error occurred. So when the client sends a request for an Id that does not exist, say 537, the REST Service sends it a custom JSON response instead of the 500 Internal Server Error.
Level up your interview prep. Join Educative to access 80+ hands-on prep courses.