Skip to main content

Posts

Showing posts with the label basic exception

Exception Handling in RESTful Web Services

Introduction Exception Handling in RESTful webservices is very interesting as well as important topic while writing RESTful web services. Whenever any exception occurs in our web service, by default it will show error with HTTP error code with the description which user can’t understand easily. Why one should handle Exceptions in Restful Web services? User should understand if any error occurred in the system and he/she should easily understand what to do next so that error will not come again as most of the error are due to wrong input given by user and if sometimes error is due to our application he should clearly know that. How to Handle Exceptions in Restful Web services? In RESTful web services, usually response will be in JSON format. So, we need to create response object which will give error in JSON format. Woooooh So let’s get hand dirty. ------------------------------------------------------------------------------------------------- //ErrorRes...