Class ApiExceptionHandler


  • @Order(2147483647)
    @RestControllerAdvice
    public class ApiExceptionHandler
    extends java.lang.Object
    Class for handling exceptions.
    Since:
    1.0.0
    Author:
    Urvil Joshi
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.springframework.http.ResponseEntity<io.mosip.kernel.core.http.ResponseWrapper<io.mosip.kernel.core.exception.ServiceError>> defaultErrorHandler​(javax.servlet.http.HttpServletRequest httpServletRequest, java.lang.Exception e)  
      org.springframework.http.ResponseEntity<io.mosip.kernel.core.http.ResponseWrapper<io.mosip.kernel.core.exception.ServiceError>> httpServerErrorException​(javax.servlet.http.HttpServletRequest httpServletRequest, org.springframework.web.client.HttpServerErrorException exception)  
      org.springframework.http.ResponseEntity<io.mosip.kernel.core.http.ResponseWrapper<io.mosip.kernel.core.exception.ServiceError>> onHttpMessageNotReadable​(javax.servlet.http.HttpServletRequest httpServletRequest, org.springframework.http.converter.HttpMessageNotReadableException e)
      This method handle HttpMessageNotReadableException type of exception.
      org.springframework.http.ResponseEntity<io.mosip.kernel.core.http.ResponseWrapper<io.mosip.kernel.core.exception.ServiceError>> smsInvalidInputsFound​(javax.servlet.http.HttpServletRequest httpServletRequest, org.springframework.web.bind.MethodArgumentNotValidException exception)
      This method handles MethodArgumentNotValidException type of exceptions.
      org.springframework.http.ResponseEntity<io.mosip.kernel.core.http.ResponseWrapper<io.mosip.kernel.core.exception.ServiceError>> smsNotificationInvalidNumber​(javax.servlet.http.HttpServletRequest httpServletRequest, io.mosip.kernel.core.notification.exception.InvalidNumberException e)
      This method handles MosipInvalidNumberException type of exceptions.
      org.springframework.http.ResponseEntity<io.mosip.kernel.core.http.ResponseWrapper<io.mosip.kernel.core.exception.ServiceError>> smsVendorServiceException​(javax.servlet.http.HttpServletRequest httpServletRequest, org.springframework.web.client.HttpClientErrorException e)
      This method handle HttpClientErrorException type of exception.
      • Methods inherited from class java.lang.Object

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

      • ApiExceptionHandler

        public ApiExceptionHandler()
    • Method Detail

      • smsInvalidInputsFound

        @ExceptionHandler(org.springframework.web.bind.MethodArgumentNotValidException.class)
        public org.springframework.http.ResponseEntity<io.mosip.kernel.core.http.ResponseWrapper<io.mosip.kernel.core.exception.ServiceError>> smsInvalidInputsFound​(javax.servlet.http.HttpServletRequest httpServletRequest,
                                                                                                                                                                     org.springframework.web.bind.MethodArgumentNotValidException exception)
                                                                                                                                                              throws java.io.IOException
        This method handles MethodArgumentNotValidException type of exceptions.
        Parameters:
        httpServletRequest - the request
        exception - The exception
        Returns:
        The response entity.
        Throws:
        java.io.IOException - the IOException
      • smsNotificationInvalidNumber

        @ExceptionHandler(io.mosip.kernel.core.notification.exception.InvalidNumberException.class)
        public org.springframework.http.ResponseEntity<io.mosip.kernel.core.http.ResponseWrapper<io.mosip.kernel.core.exception.ServiceError>> smsNotificationInvalidNumber​(javax.servlet.http.HttpServletRequest httpServletRequest,
                                                                                                                                                                            io.mosip.kernel.core.notification.exception.InvalidNumberException e)
                                                                                                                                                                     throws java.io.IOException
        This method handles MosipInvalidNumberException type of exceptions.
        Parameters:
        httpServletRequest - the request
        e - The exception
        Returns:
        The response entity.
        Throws:
        java.io.IOException - the IOException
      • onHttpMessageNotReadable

        @ExceptionHandler(org.springframework.http.converter.HttpMessageNotReadableException.class)
        public org.springframework.http.ResponseEntity<io.mosip.kernel.core.http.ResponseWrapper<io.mosip.kernel.core.exception.ServiceError>> onHttpMessageNotReadable​(javax.servlet.http.HttpServletRequest httpServletRequest,
                                                                                                                                                                        org.springframework.http.converter.HttpMessageNotReadableException e)
                                                                                                                                                                 throws java.io.IOException
        This method handle HttpMessageNotReadableException type of exception.
        Parameters:
        httpServletRequest - the request.
        e - the exception.
        Returns:
        the response entity.
        Throws:
        java.io.IOException - IOException.
      • smsVendorServiceException

        @ExceptionHandler(org.springframework.web.client.HttpClientErrorException.class)
        public org.springframework.http.ResponseEntity<io.mosip.kernel.core.http.ResponseWrapper<io.mosip.kernel.core.exception.ServiceError>> smsVendorServiceException​(javax.servlet.http.HttpServletRequest httpServletRequest,
                                                                                                                                                                         org.springframework.web.client.HttpClientErrorException e)
                                                                                                                                                                  throws java.io.IOException
        This method handle HttpClientErrorException type of exception.
        Parameters:
        httpServletRequest - the request.
        e - the exception.
        Returns:
        the response entity.
        Throws:
        java.io.IOException - IOException.
      • httpServerErrorException

        @ExceptionHandler(org.springframework.web.client.HttpServerErrorException.class)
        public org.springframework.http.ResponseEntity<io.mosip.kernel.core.http.ResponseWrapper<io.mosip.kernel.core.exception.ServiceError>> httpServerErrorException​(javax.servlet.http.HttpServletRequest httpServletRequest,
                                                                                                                                                                        org.springframework.web.client.HttpServerErrorException exception)
                                                                                                                                                                 throws java.io.IOException
        Throws:
        java.io.IOException
      • defaultErrorHandler

        @ExceptionHandler({java.lang.Exception.class,java.lang.RuntimeException.class})
        public org.springframework.http.ResponseEntity<io.mosip.kernel.core.http.ResponseWrapper<io.mosip.kernel.core.exception.ServiceError>> defaultErrorHandler​(javax.servlet.http.HttpServletRequest httpServletRequest,
                                                                                                                                                                   java.lang.Exception e)
                                                                                                                                                            throws java.io.IOException
        Throws:
        java.io.IOException