This Example allocates a simple Rest API that calls a fake service class. The purpose of this demo is to handle some bad API calls from the frontend and let the backend respond accordingly.
- Custom Exception ResourceNotFoundException:
can be used to throw an error when querying a resource in your DB.
- MissingRequestHeaderException:
Self-explanatory: used when an argument in the request header is missing.
- MethodArgumentTypeMismatchException:
Triggered when the argument in the request is in the wrong data-type.
- NoHandlerFoundException
Triggered when the exception has no exception-handler, in this demo it was implemented as a trigger for calling an API address that does not exist.
Only Spring Web was used as a dependency.