Class GlobalControllerExceptionHandler


  • @ControllerAdvice
    class GlobalControllerExceptionHandler
    extends 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<Object> handleExceptionAllExceptions​(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<Object> handleNullPointerExceptions​(Exception ex,
                                                                                                 org.springframework.web.context.request.WebRequest request)
      • handleMethodNotSupportedExceptions

        @ExceptionHandler(org.springframework.web.HttpRequestMethodNotSupportedException.class)
        public final org.springframework.http.ResponseEntity<Object> handleMethodNotSupportedExceptions​(Exception 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)
      • handleMissingServletRequestPartException

        @ExceptionHandler(org.springframework.web.multipart.support.MissingServletRequestPartException.class)
        public final org.springframework.http.ResponseEntity<Object> handleMissingServletRequestPartException​(Exception ex,
                                                                                                              org.springframework.web.context.request.WebRequest request)
      • handleUnableToReadInputStreamException

        @ExceptionHandler(UnableToReadInputStreamException.class)
        public final org.springframework.http.ResponseEntity<Object> handleUnableToReadInputStreamException​(Exception ex,
                                                                                                            org.springframework.web.context.request.WebRequest request)