Class ExceptionResponseMapping
- java.lang.Object
-
- edu.cnm.deepdive.interviewprep.controller.ExceptionResponseMapping
-
@RestControllerAdvice public class ExceptionResponseMapping extends Object
This is the class that REST communicates to JPA that an exception has occurred, returns a user friendly status code in the header response.
-
-
Constructor Summary
Constructors Constructor Description ExceptionResponseMapping()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
badRequest()
This method handles an illegal argument exception from the rest endpoint and returns a user-friendly status code in the header response.void
notFound()
This method handles a no such element exception from the REST endpoint, and returns a user-friendly status code in the header response.
-
-
-
Method Detail
-
notFound
@ExceptionHandler(java.util.NoSuchElementException.class) @ResponseStatus(value=NOT_FOUND, reason="Resource not found") public void notFound()
This method handles a no such element exception from the REST endpoint, and returns a user-friendly status code in the header response.
-
badRequest
@ExceptionHandler(java.lang.IllegalArgumentException.class) @ResponseStatus(value=BAD_REQUEST, reason="Invalid request content") public void badRequest()
This method handles an illegal argument exception from the rest endpoint and returns a user-friendly status code in the header response.
-
-