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