Class RestExceptionHandler
java.lang.Object
org.sklsft.commons.rest.exception.RestExceptionHandler
How to handle exceptions : If it is an Else, an unknown
ApplicationException, it
will be serialized to an ErrorReport TechnicalError will replace it for serialization.- Author:
- Nicolas Thibault
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.sklsft.commons.api.exception.ErrorReporthandleApplicationException(org.sklsft.commons.api.exception.ApplicationException e) org.sklsft.commons.api.exception.ErrorReporthandleApplicationException(org.sklsft.commons.api.exception.repository.ObjectNotFoundException e) org.sklsft.commons.api.exception.ErrorReporthandleApplicationException(org.sklsft.commons.api.exception.rights.AccessDeniedException e) org.sklsft.commons.api.exception.ErrorReporthandleApplicationException(org.springframework.security.access.AccessDeniedException e) org.sklsft.commons.api.exception.ErrorReportorg.sklsft.commons.api.exception.ErrorReporthandleException(org.springframework.web.bind.MethodArgumentNotValidException e) voidsetPrintErrorStackInRootLogger(boolean printErrorStackInRootLogger)
-
Constructor Details
-
RestExceptionHandler
public RestExceptionHandler()
-
-
Method Details
-
setPrintErrorStackInRootLogger
public void setPrintErrorStackInRootLogger(boolean printErrorStackInRootLogger) -
handleApplicationException
@ResponseStatus(FORBIDDEN) @ExceptionHandler(org.sklsft.commons.api.exception.rights.AccessDeniedException.class) @ResponseBody public org.sklsft.commons.api.exception.ErrorReport handleApplicationException(org.sklsft.commons.api.exception.rights.AccessDeniedException e) -
handleApplicationException
@ResponseStatus(FORBIDDEN) @ExceptionHandler(org.springframework.security.access.AccessDeniedException.class) @ResponseBody public org.sklsft.commons.api.exception.ErrorReport handleApplicationException(org.springframework.security.access.AccessDeniedException e) -
handleApplicationException
@ResponseStatus(NOT_FOUND) @ExceptionHandler(org.sklsft.commons.api.exception.repository.ObjectNotFoundException.class) @ResponseBody public org.sklsft.commons.api.exception.ErrorReport handleApplicationException(org.sklsft.commons.api.exception.repository.ObjectNotFoundException e) -
handleApplicationException
@ResponseStatus(INTERNAL_SERVER_ERROR) @ExceptionHandler(org.sklsft.commons.api.exception.ApplicationException.class) @ResponseBody public org.sklsft.commons.api.exception.ErrorReport handleApplicationException(org.sklsft.commons.api.exception.ApplicationException e) -
handleException
@ResponseStatus(INTERNAL_SERVER_ERROR) @ExceptionHandler(java.lang.Exception.class) @ResponseBody public org.sklsft.commons.api.exception.ErrorReport handleException(Exception e) -
handleException
@ResponseStatus(BAD_REQUEST) @ExceptionHandler(org.springframework.web.bind.MethodArgumentNotValidException.class) @ResponseBody public org.sklsft.commons.api.exception.ErrorReport handleException(org.springframework.web.bind.MethodArgumentNotValidException e)
-