Class GlobalControllerExceptionHandler


  • @ControllerAdvice
    class GlobalControllerExceptionHandler
    extends java.lang.Object
    Intercepts Exceptions thrown in the service. Ensures a uniform response format and that a correct HTTP status is set
    • Field Detail

      • logger

        private org.slf4j.Logger logger
    • Constructor Detail

      • GlobalControllerExceptionHandler

        GlobalControllerExceptionHandler()
    • Method Detail

      • handleExceptionAllExceptions

        @ExceptionHandler(java.lang.Exception.class)
        public final org.springframework.http.ResponseEntity<java.lang.Object> handleExceptionAllExceptions​(java.lang.Exception ex,
                                                                                                            org.springframework.web.context.request.WebRequest request)
        Handles all exceptions thrown unless cached by a more specific handler
        Parameters:
        ex - Exception thrown
        request - WebRequest from client
        Returns:
        ResponseEntity
      • handleNullPointerExceptions

        @ExceptionHandler(java.lang.NullPointerException.class)
        public final org.springframework.http.ResponseEntity<java.lang.Object> handleNullPointerExceptions​(java.lang.Exception ex,
                                                                                                           org.springframework.web.context.request.WebRequest request)
      • handleMethodNotSupportedExceptions

        @ExceptionHandler(org.springframework.web.HttpRequestMethodNotSupportedException.class)
        public final org.springframework.http.ResponseEntity<java.lang.Object> handleMethodNotSupportedExceptions​(java.lang.Exception ex,
                                                                                                                  org.springframework.web.context.request.WebRequest request)
      • handleIllegalArgumentExceptions

        @ExceptionHandler(java.lang.IllegalArgumentException.class)
        public org.springframework.http.ResponseEntity handleIllegalArgumentExceptions​(java.lang.IllegalArgumentException ex,
                                                                                       org.springframework.web.context.request.WebRequest request)
      • handleMethodArgumentNotValidException

        @ExceptionHandler(org.springframework.web.bind.MethodArgumentNotValidException.class)
        public org.springframework.http.ResponseEntity handleMethodArgumentNotValidException​(org.springframework.web.bind.MethodArgumentNotValidException ex,
                                                                                             org.springframework.web.context.request.WebRequest request)