Class IdAuthExceptionHandler
- java.lang.Object
-
- org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler
-
- io.mosip.authentication.common.service.exception.IdAuthExceptionHandler
-
@RestControllerAdvice public class IdAuthExceptionHandler extends org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandlerThe Class IDAExceptionHandler - Spring MVC Exceptions as defined inResponseEntityExceptionHandlerand any other Exceptions occurs and returns custom exception responseAuthResponseDTO.- Author:
- Manoj SP, Mamta A
-
-
Constructor Summary
Constructors Constructor Description IdAuthExceptionHandler()Instantiates a new id auth exception handler.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ObjectbuildExceptionResponse(Exception ex, javax.servlet.http.HttpServletRequest request)Constructs exception response body for all exceptions.static ObjectbuildExceptionResponse(Exception ex, javax.servlet.http.HttpServletRequest request, List<AuthError> errors)static List<AuthError>getAuthErrors(Exception ex)protected org.springframework.http.ResponseEntity<Object>handleAllExceptions(Exception ex, org.springframework.web.context.request.WebRequest request)Handle all exceptions.protected org.springframework.http.ResponseEntity<Object>handleExceptionInternal(Exception ex, Object errorMessage, org.springframework.http.HttpHeaders headers, org.springframework.http.HttpStatus status, org.springframework.web.context.request.WebRequest request)Method to handle all exception and return as customized response object.protected org.springframework.http.ResponseEntity<Object>handleIdAppException(IdAuthenticationBaseException ex, org.springframework.web.context.request.WebRequest request)Method to handle and customize the response.-
Methods inherited from class org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler
handleAsyncRequestTimeoutException, handleBindException, handleConversionNotSupported, handleException, handleHttpMediaTypeNotAcceptable, handleHttpMediaTypeNotSupported, handleHttpMessageNotReadable, handleHttpMessageNotWritable, handleHttpRequestMethodNotSupported, handleMethodArgumentNotValid, handleMissingPathVariable, handleMissingServletRequestParameter, handleMissingServletRequestPart, handleNoHandlerFoundException, handleServletRequestBindingException, handleTypeMismatch
-
-
-
-
Method Detail
-
handleAllExceptions
@ExceptionHandler(java.lang.Exception.class) protected org.springframework.http.ResponseEntity<Object> handleAllExceptions(Exception ex, org.springframework.web.context.request.WebRequest request)
Handle all exceptions.- Parameters:
ex- the exrequest- the request- Returns:
- the response entity
-
handleExceptionInternal
protected org.springframework.http.ResponseEntity<Object> handleExceptionInternal(Exception ex, @Nullable Object errorMessage, org.springframework.http.HttpHeaders headers, org.springframework.http.HttpStatus status, org.springframework.web.context.request.WebRequest request)
Method to handle all exception and return as customized response object.- Overrides:
handleExceptionInternalin classorg.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler- Parameters:
ex- ExceptionerrorMessage- List of error messagesheaders- Http headersstatus- Http statusrequest- Web request- Returns:
- Customized response object
- See Also:
ResponseEntityExceptionHandler.handleExceptionInternal(java.lang.Exception, java.lang.Object, org.springframework.http.HttpHeaders, org.springframework.http.HttpStatus, org.springframework.web.context.request.WebRequest)
-
handleIdAppException
@ExceptionHandler(io.mosip.authentication.core.exception.IdAuthenticationBaseException.class) protected org.springframework.http.ResponseEntity<Object> handleIdAppException(IdAuthenticationBaseException ex, org.springframework.web.context.request.WebRequest request)
Method to handle and customize the response.- Parameters:
ex- Exceptionrequest- Web request- Returns:
- ResponseEntity containing error response object and http status.
-
buildExceptionResponse
public static Object buildExceptionResponse(Exception ex, javax.servlet.http.HttpServletRequest request)
Constructs exception response body for all exceptions.- Parameters:
ex- the exception occurredrequest- the request- Returns:
- Object .
-
buildExceptionResponse
public static Object buildExceptionResponse(Exception ex, javax.servlet.http.HttpServletRequest request, List<AuthError> errors)
-
-