Class ApiExceptionHandler


  • @Order(2147483647)
    @RestControllerAdvice
    public class ApiExceptionHandler
    extends Object
    Class for handling exceptions.
    Since:
    1.0.0
    Author:
    Urvil Joshi
    • Constructor Detail

      • ApiExceptionHandler

        public ApiExceptionHandler()
    • Method Detail

      • smsInvalidInputsFound

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

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

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

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