Class IridaCustomExceptionHandler


  • @ControllerAdvice(basePackages="ca.corefacility.bioinformatics.irida.ria.web")
    public class IridaCustomExceptionHandler
    extends org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler
    Exception Handler for when a user is navigating around in the web interface.
    • Field Summary

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

        PAGE_NOT_FOUND_LOG_CATEGORY, pageNotFoundLogger
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void handleAccessDeniedException​(org.springframework.security.access.AccessDeniedException ex, javax.servlet.http.HttpServletResponse response)
      Handle an AccessDeniedException
      void handleIOException​(java.io.IOException e, java.util.Locale locale, javax.servlet.http.HttpServletResponse response)
      Catch and handle IOExceptions.
      org.springframework.web.servlet.ModelAndView handleOAuthProblemException​(org.apache.oltu.oauth2.common.exception.OAuthProblemException ex)
      Catch an OAuthProblemException and return an http 500 error
      void handleOtherExceptions​(java.lang.Exception ex, javax.servlet.http.HttpServletResponse response)
      Catch and handle all other exception types and respond with 500 status code.
      void handleResourceNotFoundException​(EntityNotFoundException ex, javax.servlet.http.HttpServletResponse response)
      void handleStorageException​(StorageException e, java.util.Locale locale, javax.servlet.http.HttpServletResponse response)
      Catch and handle all StorageExceptions.
      • Methods inherited from class org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler

        handleAsyncRequestTimeoutException, handleBindException, handleConversionNotSupported, handleException, handleExceptionInternal, handleHttpMediaTypeNotAcceptable, handleHttpMediaTypeNotSupported, handleHttpMessageNotReadable, handleHttpMessageNotWritable, handleHttpRequestMethodNotSupported, handleMethodArgumentNotValid, handleMissingPathVariable, handleMissingServletRequestParameter, handleMissingServletRequestPart, handleNoHandlerFoundException, handleServletRequestBindingException, handleTypeMismatch
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • IridaCustomExceptionHandler

        public IridaCustomExceptionHandler()
    • Method Detail

      • handleResourceNotFoundException

        @ExceptionHandler(EntityNotFoundException.class)
        public void handleResourceNotFoundException​(EntityNotFoundException ex,
                                                    javax.servlet.http.HttpServletResponse response)
                                             throws java.io.IOException
        Parameters:
        ex - The EntityNotFoundException caught
        response - The HttpServletResponse
        Throws:
        java.io.IOException - If an input or output exception occurs
      • handleAccessDeniedException

        @ExceptionHandler(org.springframework.security.access.AccessDeniedException.class)
        public void handleAccessDeniedException​(org.springframework.security.access.AccessDeniedException ex,
                                                javax.servlet.http.HttpServletResponse response)
                                         throws java.io.IOException
        Handle an AccessDeniedException
        Parameters:
        ex - The AccessDeniedException caught
        response - The HttpServletResponse
        Throws:
        java.io.IOException - If an input or output exception occurs
      • handleOAuthProblemException

        @ExceptionHandler(org.apache.oltu.oauth2.common.exception.OAuthProblemException.class)
        @ResponseStatus(INTERNAL_SERVER_ERROR)
        public org.springframework.web.servlet.ModelAndView handleOAuthProblemException​(org.apache.oltu.oauth2.common.exception.OAuthProblemException ex)
        Catch an OAuthProblemException and return an http 500 error
        Parameters:
        ex - the caught OAuthProblemException
        Returns:
        A ModelAndView containing the name of the oauth error view
      • handleOtherExceptions

        @ExceptionHandler(java.lang.Exception.class)
        public void handleOtherExceptions​(java.lang.Exception ex,
                                          javax.servlet.http.HttpServletResponse response)
                                   throws java.io.IOException
        Catch and handle all other exception types and respond with 500 status code.
        Parameters:
        ex - the exception that was originally thrown.
        response - The HttpServletResponse
        Throws:
        java.io.IOException - If an input or output exception occurs
      • handleIOException

        @ExceptionHandler(java.io.IOException.class)
        public void handleIOException​(java.io.IOException e,
                                      java.util.Locale locale,
                                      javax.servlet.http.HttpServletResponse response)
                               throws java.io.IOException
        Catch and handle IOExceptions. Render an error that's just a general storage exception.
        Parameters:
        e - the exception that was originally thrown.
        locale - the locale of the request.
        response - The HttpServletResponse
        Throws:
        java.io.IOException - If an input or output exception occurs
      • handleStorageException

        @ExceptionHandler(StorageException.class)
        public void handleStorageException​(StorageException e,
                                           java.util.Locale locale,
                                           javax.servlet.http.HttpServletResponse response)
                                    throws java.io.IOException
        Catch and handle all StorageExceptions. Try your best to figure out the root cause of the exception.
        Parameters:
        e - the exception that was originally thrown.
        locale - the locale of the request.
        response - The HttpServletResponse
        Throws:
        java.io.IOException - If an input or output exception occurs