Class 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
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void badRequest()
      Changes IllegalArgumentException into a 400 Bad Request response.
      void notFound()
      Changes NoSuchElementException into a 404 Not Found response.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ErrorConfiguration

        public ErrorConfiguration()
    • Method Detail

      • notFound

        @ExceptionHandler(java.util.NoSuchElementException.class)
        @ResponseStatus(value=NOT_FOUND,
                        reason="Resource not found or moved")
        public void notFound()
        Changes NoSuchElementException into a 404 Not Found response.
      • badRequest

        @ExceptionHandler(java.lang.IllegalArgumentException.class)
        @ResponseStatus(value=BAD_REQUEST,
                        reason="Empty request body or invalid information")
        public void badRequest()
        Changes IllegalArgumentException into a 400 Bad Request response.