Class RestExceptionHandler
java.lang.Object
org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler
es.kukenan.smartfi.springboot.controller.RestExceptionHandler
@ControllerAdvice
public class RestExceptionHandler
extends org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler
REST service exception handler.
-
Field Summary
Fields inherited from class org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler
logger, PAGE_NOT_FOUND_LOG_CATEGORY, pageNotFoundLogger -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity<Object>handleAccessDeniedException(org.springframework.security.access.AccessDeniedException ex, org.springframework.web.context.request.WebRequest request) Handle a AccessDeniedException as a forbidden error.org.springframework.http.ResponseEntity<Object>handleAuthenticationException(org.springframework.security.core.AuthenticationException ex, org.springframework.web.context.request.WebRequest request) Handle a AuthenticationException as an unauthenticated error.protected org.springframework.http.ResponseEntity<Object>handleExceptionInternal(Exception ex, Object body, org.springframework.http.HttpHeaders headers, org.springframework.http.HttpStatus status, org.springframework.web.context.request.WebRequest request) protected org.springframework.http.ResponseEntity<Object>handleMissingServletRequestParameter(org.springframework.web.bind.MissingServletRequestParameterException ex, org.springframework.http.HttpHeaders headers, org.springframework.http.HttpStatus status, org.springframework.web.context.request.WebRequest request) org.springframework.http.ResponseEntity<Object>handleRuntimeException(RuntimeException ex, org.springframework.web.context.request.WebRequest request) Handle any other exception.org.springframework.http.ResponseEntity<Object>handleUnexpectedException(UnexpectedException ex, org.springframework.web.context.request.WebRequest request) Handle a UnexpectedException as undefined error condition.org.springframework.http.ResponseEntity<Object>handleWalletException(KukenanWalletException ex, org.springframework.web.context.request.WebRequest request) Handle a WalletException as defined error condition.Methods inherited from class org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler
handleAsyncRequestTimeoutException, handleBindException, handleConversionNotSupported, handleException, handleHttpMediaTypeNotAcceptable, handleHttpMediaTypeNotSupported, handleHttpMessageNotReadable, handleHttpMessageNotWritable, handleHttpRequestMethodNotSupported, handleMethodArgumentNotValid, handleMissingPathVariable, handleMissingServletRequestPart, handleNoHandlerFoundException, handleServletRequestBindingException, handleTypeMismatch
-
Constructor Details
-
RestExceptionHandler
public RestExceptionHandler()
-
-
Method Details
-
handleWalletException
@ExceptionHandler(es.kukenan.smartfi.common.service.exceptions.KukenanWalletException.class) public org.springframework.http.ResponseEntity<Object> handleWalletException(KukenanWalletException ex, org.springframework.web.context.request.WebRequest request) Handle a WalletException as defined error condition.- Parameters:
ex- the exception thrown.request- the request in which context the exception has been thrown.- Returns:
- the entity that wraps de JSON error response.
-
handleUnexpectedException
@ExceptionHandler(es.kukenan.smartfi.common.service.exceptions.UnexpectedException.class) public org.springframework.http.ResponseEntity<Object> handleUnexpectedException(UnexpectedException ex, org.springframework.web.context.request.WebRequest request) Handle a UnexpectedException as undefined error condition.- Parameters:
ex- the exception thrown.request- the request in which context the exception has been thrown.- Returns:
- the entity that wraps de JSON error response.
-
handleAuthenticationException
@ExceptionHandler(org.springframework.security.core.AuthenticationException.class) public org.springframework.http.ResponseEntity<Object> handleAuthenticationException(org.springframework.security.core.AuthenticationException ex, org.springframework.web.context.request.WebRequest request) Handle a AuthenticationException as an unauthenticated error.- Parameters:
ex- the exception thrown.request- the request in which context the exception has been thrown.- Returns:
- the entity that wraps de JSON error response.
-
handleAccessDeniedException
@ExceptionHandler(org.springframework.security.access.AccessDeniedException.class) public org.springframework.http.ResponseEntity<Object> handleAccessDeniedException(org.springframework.security.access.AccessDeniedException ex, org.springframework.web.context.request.WebRequest request) Handle a AccessDeniedException as a forbidden error.- Parameters:
ex- the exception thrown.request- the request in which context the exception has been thrown.- Returns:
- the entity that wraps de JSON error response.
-
handleRuntimeException
@ExceptionHandler(java.lang.RuntimeException.class) public org.springframework.http.ResponseEntity<Object> handleRuntimeException(RuntimeException ex, org.springframework.web.context.request.WebRequest request) Handle any other exception.- Parameters:
ex- the exception thrown.request- the request in which context the exception has been thrown.- Returns:
- the entity that wraps de JSON error response.
-
handleMissingServletRequestParameter
protected org.springframework.http.ResponseEntity<Object> handleMissingServletRequestParameter(org.springframework.web.bind.MissingServletRequestParameterException ex, org.springframework.http.HttpHeaders headers, org.springframework.http.HttpStatus status, org.springframework.web.context.request.WebRequest request) - Overrides:
handleMissingServletRequestParameterin classorg.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler
-
handleExceptionInternal
protected org.springframework.http.ResponseEntity<Object> handleExceptionInternal(Exception ex, Object body, org.springframework.http.HttpHeaders headers, org.springframework.http.HttpStatus status, org.springframework.web.context.request.WebRequest request) - Overrides:
handleExceptionInternalin classorg.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler
-