Class ExceptionHandlers


  • @Order(-2147483648)
    @ControllerAdvice
    public class ExceptionHandlers
    extends org.craftercms.commons.validation.rest.ValidationAwareRestExceptionHandlers
    Extension of BaseRestExceptionHandlers that provides exception handlers for specific Crafter Deployer exceptions.
    Author:
    avasquez
    • Field Summary

      • Fields inherited from class org.craftercms.commons.validation.rest.ValidationAwareRestExceptionHandlers

        errorMessageBundle
      • Fields inherited from class org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler

        logger, PAGE_NOT_FOUND_LOG_CATEGORY, pageNotFoundLogger
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.springframework.http.ResponseEntity<Object> handleConstraintValidationException​(javax.validation.ConstraintViolationException e, org.springframework.web.context.request.WebRequest request)  
      org.springframework.http.ResponseEntity<Object> handleInvalidManagementTokenException​(org.craftercms.commons.exceptions.InvalidManagementTokenException ex, org.springframework.web.context.request.WebRequest request)  
      protected org.springframework.http.ResponseEntity<Object> handleMethodArgumentNotValid​(org.springframework.web.bind.MethodArgumentNotValidException ex, org.springframework.http.HttpHeaders headers, org.springframework.http.HttpStatus status, org.springframework.web.context.request.WebRequest request)  
      org.springframework.http.ResponseEntity<Object> handleTargetAlreadyExistsException​(TargetAlreadyExistsException ex, org.springframework.web.context.request.WebRequest request)
      Handles a TargetAlreadyExistsException by returning a 409 CONFLICT.
      org.springframework.http.ResponseEntity<Object> handleTargetNotFoundException​(TargetNotFoundException ex, org.springframework.web.context.request.WebRequest request)
      Handles a TargetNotFoundException by returning a 404 NOT FOUND.
      org.springframework.http.ResponseEntity<Object> handleUnsupportedSearchEngineException​(UnsupportedSearchEngineException ex, org.springframework.web.context.request.WebRequest request)
      Handles a UnsupportedSearchEngineException by returning a 400 BAD REQUEST.
      • Methods inherited from class org.craftercms.commons.validation.rest.ValidationAwareRestExceptionHandlers

        handleGeneralException, handleHttpMessageNotReadable, handleValidationException, setErrorMessageBundle
      • Methods inherited from class org.craftercms.commons.rest.BaseRestExceptionHandlers

        handleExceptionInternal, handleExceptionInternal
      • Methods inherited from class org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler

        handleAsyncRequestTimeoutException, handleBindException, handleConversionNotSupported, handleException, handleHttpMediaTypeNotAcceptable, handleHttpMediaTypeNotSupported, handleHttpMessageNotWritable, handleHttpRequestMethodNotSupported, handleMissingPathVariable, handleMissingServletRequestParameter, handleMissingServletRequestPart, handleNoHandlerFoundException, handleServletRequestBindingException, handleTypeMismatch
    • Constructor Detail

      • ExceptionHandlers

        public ExceptionHandlers()
    • Method Detail

      • handleTargetNotFoundException

        @ExceptionHandler(TargetNotFoundException.class)
        public org.springframework.http.ResponseEntity<Object> handleTargetNotFoundException​(TargetNotFoundException ex,
                                                                                             org.springframework.web.context.request.WebRequest request)
        Handles a TargetNotFoundException by returning a 404 NOT FOUND.
        Parameters:
        ex - the exception
        request - the current request
        Returns:
        the response entity, with the body and status
      • handleConstraintValidationException

        @ResponseStatus(BAD_REQUEST)
        @ExceptionHandler(javax.validation.ConstraintViolationException.class)
        public org.springframework.http.ResponseEntity<Object> handleConstraintValidationException​(javax.validation.ConstraintViolationException e,
                                                                                                   org.springframework.web.context.request.WebRequest request)
      • handleInvalidManagementTokenException

        @ExceptionHandler(org.craftercms.commons.exceptions.InvalidManagementTokenException.class)
        public org.springframework.http.ResponseEntity<Object> handleInvalidManagementTokenException​(org.craftercms.commons.exceptions.InvalidManagementTokenException ex,
                                                                                                     org.springframework.web.context.request.WebRequest request)
      • handleMethodArgumentNotValid

        protected org.springframework.http.ResponseEntity<Object> handleMethodArgumentNotValid​(org.springframework.web.bind.MethodArgumentNotValidException ex,
                                                                                               org.springframework.http.HttpHeaders headers,
                                                                                               org.springframework.http.HttpStatus status,
                                                                                               org.springframework.web.context.request.WebRequest request)
        Overrides:
        handleMethodArgumentNotValid in class org.craftercms.commons.validation.rest.ValidationAwareRestExceptionHandlers