Class ApiExceptionHandler


  • @RestControllerAdvice
    public class ApiExceptionHandler
    extends Object
    Class for handling API exceptions
    Since:
    1.0.0
    Author:
    Dharmesh Khandelwal, Bal Vikash Sharma
    • 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, Exception e)  
      org.springframework.http.ResponseEntity<io.mosip.kernel.core.http.ResponseWrapper<io.mosip.kernel.core.exception.ServiceError>> methodArgumentNotValidException​(javax.servlet.http.HttpServletRequest httpServletRequest, org.springframework.web.bind.MethodArgumentNotValidException e)
      This method handle MethodArgumentNotValidException.
      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)  
    • Constructor Detail

      • ApiExceptionHandler

        public ApiExceptionHandler()
    • Method Detail

      • methodArgumentNotValidException

        @ExceptionHandler(org.springframework.web.bind.MethodArgumentNotValidException.class)
        public org.springframework.http.ResponseEntity<io.mosip.kernel.core.http.ResponseWrapper<io.mosip.kernel.core.exception.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<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 IOException
        Throws:
        IOException