Class ApiExceptionHandler


  • @RestControllerAdvice
    public class ApiExceptionHandler
    extends Object
    Class for handling API exceptions
    Since:
    1.0.0
    Author:
    Dharmesh Khandelwal, Bal Vikash Sharma
    • Constructor Detail

      • ApiExceptionHandler

        public ApiExceptionHandler()
    • Method Detail

      • methodArgumentNotValidException

        @ExceptionHandler(org.springframework.web.bind.MethodArgumentNotValidException.class)
        public org.springframework.http.ResponseEntity<ResponseWrapper<ServiceError>> methodArgumentNotValidException​(javax.servlet.http.HttpServletRequest httpServletRequest,
                                                                                                                      org.springframework.web.bind.MethodArgumentNotValidException e)
                                                                                                               throws IOException
        This method handle MethodArgumentNotValidException.
        Parameters:
        httpServletRequest - the request
        e - the exception
        Returns:
        the response entity.
        Throws:
        IOException - the IO Exception
      • 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
        Throws:
        IOException