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 Summary

      Fields 
      Modifier and Type Field Description
      private org.slf4j.Logger logger  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      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
      org.springframework.http.ResponseEntity handleIllegalArgumentExceptions​(java.lang.IllegalArgumentException ex, org.springframework.web.context.request.WebRequest request)  
      org.springframework.http.ResponseEntity handleMethodArgumentNotValidException​(org.springframework.web.bind.MethodArgumentNotValidException ex, org.springframework.web.context.request.WebRequest request)  
      org.springframework.http.ResponseEntity<java.lang.Object> handleMethodNotSupportedExceptions​(java.lang.Exception ex, org.springframework.web.context.request.WebRequest request)  
      org.springframework.http.ResponseEntity<java.lang.Object> handleNullPointerExceptions​(java.lang.Exception ex, org.springframework.web.context.request.WebRequest request)  
      org.springframework.http.ResponseEntity<java.lang.Object> handleUnableToAnonymizeDataException​(UnableToAnonymizeDataException ex, org.springframework.web.context.request.WebRequest request)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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)