Class ExceptionController

java.lang.Object
it.unimib.unimibmodules.exception.ExceptionController

@ControllerAdvice public class ExceptionController extends Object
Exception handler class. It handles the HTTP response for an exception.
Version:
0.4.1
Author:
Luca Milazzo
  • Field Details

    • LOGGER

      private static final org.apache.logging.log4j.Logger LOGGER
  • Constructor Details

    • ExceptionController

      public ExceptionController()
  • Method Details

    • handleFormatException

      @ExceptionHandler(FormatException.class) public org.springframework.http.ResponseEntity<Object> handleFormatException(FormatException ex)
      Returns a ResponseEntity to the rest client with the error message and HTTP code 400
      Parameters:
      ex - the object that contains the exception's data
      Returns:
      an HTTP response with status 400 and the error message
      See Also:
    • handleNotFoundException

      @ExceptionHandler(NotFoundException.class) public org.springframework.http.ResponseEntity<Object> handleNotFoundException(NotFoundException ex)
      Returns a ResponseEntity to the rest client with the error message and HTTP code 404
      Parameters:
      ex - the object that contains the exception's data
      Returns:
      an HTTP response with status 404 and the error message
      See Also:
    • handleEmptyFieldException

      @ExceptionHandler(EmptyFieldException.class) public org.springframework.http.ResponseEntity<Object> handleEmptyFieldException(EmptyFieldException e)
      Returns a ResponseEntity to the rest client with the error message and HTTP code 400.
      Parameters:
      e - the object that contains the exception's data
      Returns:
      an HTTP response with status 400 and the error message
      See Also:
    • handleIncorrectSizeException

      @ExceptionHandler(IncorrectSizeException.class) public org.springframework.http.ResponseEntity<Object> handleIncorrectSizeException(IncorrectSizeException e)
      Returns a ResponseEntity to the rest client with the error message and HTTP code 400.
      Parameters:
      e - the object that contains the exception's data
      Returns:
      an HTTP response with status 400 and the error message
      See Also: