@Component public class HerdErrorInformationExceptionHandler extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
ORACLE_DATA_TOO_LARGE_ERROR_CODE
The Oracle database specific error code for data too large.
|
static int |
ORACLE_LONG_DATA_IN_LONG_COLUMN_ERROR_CODE
The Oracle database specific error code for "can bind a LONG value only for insert into a LONG column".
|
static String |
ORACLE_SQL_STATE_CODE_ERROR
Oracle specific SQL state code for generic SQL statement execution errors.
|
static String |
POSTGRES_SQL_STATE_CODE_FOREIGN_KEY_VIOLATION |
static String |
POSTGRES_SQL_STATE_CODE_TRUNCATION_ERROR
PostgreSQL specific SQL state code for string data truncation errors.
|
static String |
POSTGRES_SQL_STATE_CODE_UNIQUE_INDEX_OR_PRIMARY_KEY_VIOLATION |
| Constructor and Description |
|---|
HerdErrorInformationExceptionHandler() |
| Modifier and Type | Method and Description |
|---|---|
ErrorInformation |
handleAccessDeniedException(Exception exception)
Handle access denied exceptions.
|
ErrorInformation |
handleActivitiException(Exception exception,
javax.servlet.http.HttpServletResponse response)
Handle Activiti exceptions.
|
ErrorInformation |
handleBadRequestException(Exception exception)
Handle exceptions that result in a "bad request" status.
|
ErrorInformation |
handleConflictException(Exception exception)
Handle exceptions that result in a "conflict" status.
|
ErrorInformation |
handleHttpMessageNotReadableException(org.springframework.http.converter.HttpMessageNotReadableException exception)
Handle Spring HttpMessageNotReadableException.
|
ErrorInformation |
handleInternalServerErrorException(Exception exception)
Handle exceptions that result in an "internal server error" status.
|
ErrorInformation |
handleNotFoundException(RuntimeException exception)
Handle exceptions that result in a "not found" status.
|
ErrorInformation |
handleOperationNotAllowedException(RuntimeException exception)
Handle exceptions that result in a "operation not allowed" status.
|
ErrorInformation |
handlePersistenceException(Exception exception,
javax.servlet.http.HttpServletResponse response)
Handle persistence exceptions thrown by handlers.
|
boolean |
isLoggingEnabled() |
boolean |
isReportableError(Throwable exception)
Returns whether the specified exception is one that should be reported (i.e.
|
protected void |
logError(String message,
Exception exception)
Logs an error if logging is enabled.
|
void |
setLoggingEnabled(boolean loggingEnabled) |
public static final int ORACLE_DATA_TOO_LARGE_ERROR_CODE
public static final int ORACLE_LONG_DATA_IN_LONG_COLUMN_ERROR_CODE
public static final String ORACLE_SQL_STATE_CODE_ERROR
public static final String POSTGRES_SQL_STATE_CODE_FOREIGN_KEY_VIOLATION
public static final String POSTGRES_SQL_STATE_CODE_UNIQUE_INDEX_OR_PRIMARY_KEY_VIOLATION
public static final String POSTGRES_SQL_STATE_CODE_TRUNCATION_ERROR
public HerdErrorInformationExceptionHandler()
@ExceptionHandler(value=org.springframework.security.access.AccessDeniedException.class) @ResponseStatus(value=FORBIDDEN) @ResponseBody public ErrorInformation handleAccessDeniedException(Exception exception)
exception - the exception.@ExceptionHandler(value=org.activiti.engine.ActivitiException.class) @ResponseBody public ErrorInformation handleActivitiException(Exception exception, javax.servlet.http.HttpServletResponse response)
exception - the exception.response - the response.@ExceptionHandler(value={java.lang.IllegalArgumentException.class,org.springframework.web.bind.MissingServletRequestParameterException.class,org.springframework.beans.TypeMismatchException.class,java.io.UnsupportedEncodingException.class})
@ResponseStatus(value=BAD_REQUEST)
@ResponseBody
public ErrorInformation handleBadRequestException(Exception exception)
exception - the exception.@ExceptionHandler(value=org.springframework.http.converter.HttpMessageNotReadableException.class) @ResponseStatus(value=BAD_REQUEST) @ResponseBody public ErrorInformation handleHttpMessageNotReadableException(org.springframework.http.converter.HttpMessageNotReadableException exception)
exception - the exception.@ExceptionHandler(value={AlreadyExistsException.class,org.quartz.ObjectAlreadyExistsException.class,javax.persistence.OptimisticLockException.class})
@ResponseStatus(value=CONFLICT)
@ResponseBody
public ErrorInformation handleConflictException(Exception exception)
@ExceptionHandler(value=java.lang.Exception.class) @ResponseStatus(value=INTERNAL_SERVER_ERROR) @ResponseBody public ErrorInformation handleInternalServerErrorException(Exception exception)
@ExceptionHandler(value={org.hibernate.ObjectNotFoundException.class,ObjectNotFoundException.class})
@ResponseStatus(value=NOT_FOUND)
@ResponseBody
public ErrorInformation handleNotFoundException(RuntimeException exception)
@ExceptionHandler(value=MethodNotAllowedException.class) @ResponseStatus(value=METHOD_NOT_ALLOWED) @ResponseBody public ErrorInformation handleOperationNotAllowedException(RuntimeException exception)
@ExceptionHandler(value={org.springframework.orm.jpa.JpaSystemException.class,javax.persistence.PersistenceException.class})
@ResponseBody
public ErrorInformation handlePersistenceException(Exception exception,
javax.servlet.http.HttpServletResponse response)
exception - the exceptionresponse - the HTTP servlet response.public boolean isLoggingEnabled()
public void setLoggingEnabled(boolean loggingEnabled)
public boolean isReportableError(Throwable exception)
exception - the exception to analyze.Copyright © 2021. All rights reserved.