Class ApiExceptionHandler
java.lang.Object
io.mosip.kernel.smsserviceprovider.msg91.exception.ApiExceptionHandler
Class for handling exceptions.
- Since:
- 1.0.0
- Author:
- Urvil Joshi
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity<io.mosip.kernel.core.http.ResponseWrapper<io.mosip.kernel.core.exception.ServiceError>> defaultErrorHandler(jakarta.servlet.http.HttpServletRequest httpServletRequest, Exception e) org.springframework.http.ResponseEntity<io.mosip.kernel.core.http.ResponseWrapper<io.mosip.kernel.core.exception.ServiceError>> httpServerErrorException(jakarta.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(jakarta.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(jakarta.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(jakarta.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(jakarta.servlet.http.HttpServletRequest httpServletRequest, org.springframework.web.client.HttpClientErrorException e) This method handle HttpClientErrorException type of exception.
-
Constructor Details
-
ApiExceptionHandler
public ApiExceptionHandler()
-
-
Method Details
-
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(jakarta.servlet.http.HttpServletRequest httpServletRequest, org.springframework.web.bind.MethodArgumentNotValidException exception) throws IOException This method handles MethodArgumentNotValidException type of exceptions.- Parameters:
httpServletRequest- the requestexception- The exception- Returns:
- The response entity.
- Throws:
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(jakarta.servlet.http.HttpServletRequest httpServletRequest, io.mosip.kernel.core.notification.exception.InvalidNumberException e) throws IOException This method handles MosipInvalidNumberException type of exceptions.- Parameters:
httpServletRequest- the requeste- The exception- Returns:
- The response entity.
- Throws:
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(jakarta.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<io.mosip.kernel.core.http.ResponseWrapper<io.mosip.kernel.core.exception.ServiceError>> smsVendorServiceException(jakarta.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<io.mosip.kernel.core.http.ResponseWrapper<io.mosip.kernel.core.exception.ServiceError>> httpServerErrorException(jakarta.servlet.http.HttpServletRequest httpServletRequest, org.springframework.web.client.HttpServerErrorException exception) throws IOException - Throws:
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(jakarta.servlet.http.HttpServletRequest httpServletRequest, Exception e) throws IOException - Throws:
IOException
-