adding debug logs to GlobalThrowableMapper

revert-dabc3590
Hasunie 8 years ago
parent e7af2ee4a4
commit 30eb8ca91d

@ -51,7 +51,7 @@ public class GlobalThrowableMapper implements ExceptionMapper {
if (e instanceof JsonParseException) { if (e instanceof JsonParseException) {
String errorMessage = "Malformed request body."; String errorMessage = "Malformed request body.";
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.error(errorMessage, e); log.debug(errorMessage, e);
} }
return AndroidDeviceUtils.buildBadRequestException(errorMessage).getResponse(); return AndroidDeviceUtils.buildBadRequestException(errorMessage).getResponse();
} }
@ -63,13 +63,16 @@ public class GlobalThrowableMapper implements ExceptionMapper {
} }
if (e instanceof UnexpectedServerErrorException) { if (e instanceof UnexpectedServerErrorException) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.error("Unexpected server error", e); log.debug("Unexpected server error", e);
} }
return ((UnexpectedServerErrorException) e).getResponse(); return ((UnexpectedServerErrorException) e).getResponse();
} }
if (e instanceof ConstraintViolationException) { if (e instanceof ConstraintViolationException) {
if (log.isDebugEnabled()) {
log.debug("Constraint violation issue.", e);
return ((ParameterValidationException) e).getResponse(); return ((ParameterValidationException) e).getResponse();
} }
}
if (e instanceof IllegalArgumentException) { if (e instanceof IllegalArgumentException) {
ErrorDTO errorDetail = new ErrorDTO(); ErrorDTO errorDetail = new ErrorDTO();
errorDetail.setCode((long) 400); errorDetail.setCode((long) 400);
@ -83,7 +86,7 @@ public class GlobalThrowableMapper implements ExceptionMapper {
} }
if (e instanceof ClientErrorException) { if (e instanceof ClientErrorException) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.error("Client error", e); log.debug("Client error", e);
} }
return ((ClientErrorException) e).getResponse(); return ((ClientErrorException) e).getResponse();
} }
@ -100,7 +103,7 @@ public class GlobalThrowableMapper implements ExceptionMapper {
} }
if (e instanceof ForbiddenException) { if (e instanceof ForbiddenException) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.error("Resource forbidden", e); log.debug("Resource forbidden", e);
} }
return ((ForbiddenException) e).getResponse(); return ((ForbiddenException) e).getResponse();
} }

Loading…
Cancel
Save