Add logging for db execptons handling (#2155)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
@@ -71,9 +71,15 @@ public class ExceptionMappingAspectHandler implements Ordered {
|
|||||||
// It is a AspectJ proxy which deals with exceptions.
|
// It is a AspectJ proxy which deals with exceptions.
|
||||||
@SuppressWarnings({ "squid:S00112", "squid:S1162" })
|
@SuppressWarnings({ "squid:S00112", "squid:S1162" })
|
||||||
public void catchAndWrapJpaExceptionsService(final Exception ex) throws Throwable {
|
public void catchAndWrapJpaExceptionsService(final Exception ex) throws Throwable {
|
||||||
|
if (log.isTraceEnabled()) {
|
||||||
|
log.trace("Handling exception {}", ex.getClass().getName(), ex);
|
||||||
|
} else {
|
||||||
|
log.debug("Handling exception {}", ex.getClass().getName());
|
||||||
|
}
|
||||||
|
|
||||||
// Workaround for EclipseLink merge where it does not throw ConstraintViolationException directly in case of existing entity update
|
// Workaround for EclipseLink merge where it does not throw ConstraintViolationException directly in case of existing entity update
|
||||||
if (ex instanceof TransactionSystemException) {
|
if (ex instanceof TransactionSystemException transactionSystemException) {
|
||||||
throw replaceWithCauseIfConstraintViolationException((TransactionSystemException) ex);
|
throw replaceWithCauseIfConstraintViolationException(transactionSystemException);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (final Class<?> mappedEx : MAPPED_EXCEPTION_ORDER) {
|
for (final Class<?> mappedEx : MAPPED_EXCEPTION_ORDER) {
|
||||||
|
|||||||
@@ -279,7 +279,7 @@ public class RestConfiguration {
|
|||||||
|
|
||||||
private void logRequest(final HttpServletRequest request, final Exception ex) {
|
private void logRequest(final HttpServletRequest request, final Exception ex) {
|
||||||
if (log.isTraceEnabled()) {
|
if (log.isTraceEnabled()) {
|
||||||
log.debug("Handling exception {} of request {}", ex.getClass().getName(), request.getRequestURL(), ex);
|
log.trace("Handling exception {} of request {}", ex.getClass().getName(), request.getRequestURL(), ex);
|
||||||
} else {
|
} else {
|
||||||
log.debug("Handling exception {} of request {}", ex.getClass().getName(), request.getRequestURL());
|
log.debug("Handling exception {} of request {}", ex.getClass().getName(), request.getRequestURL());
|
||||||
}
|
}
|
||||||
@@ -334,5 +334,4 @@ public class RestConfiguration {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user