Class ErrorConfiguration
- java.lang.Object
-
- edu.cnm.deepdive.tunefull.configuration.ErrorConfiguration
-
@RestControllerAdvice public class ErrorConfiguration extends java.lang.Object
ErrorConfiguration
provides methods both to handle errors that would result in an HTTP 500 response status and to translate other responses to the desired response status code.- Since:
- 1.0
- Version:
- 1.0
- Author:
- Robert Dominugez, Roderick Frechette, Laura Steiner
-
-
Constructor Summary
Constructors Constructor Description ErrorConfiguration()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
badRequest()
ChangesIllegalArgumentException
into a400 Bad Request
response.void
notFound()
ChangesNoSuchElementException
into a404 Not Found
response.
-
-
-
Method Detail
-
notFound
@ExceptionHandler(java.util.NoSuchElementException.class) @ResponseStatus(value=NOT_FOUND, reason="Resource not found or moved") public void notFound()
ChangesNoSuchElementException
into a404 Not Found
response.
-
badRequest
@ExceptionHandler(java.lang.IllegalArgumentException.class) @ResponseStatus(value=BAD_REQUEST, reason="Empty request body or invalid information") public void badRequest()
ChangesIllegalArgumentException
into a400 Bad Request
response.
-
-