private void throwIf400WithErrorMessage(final ClientResponse response) {
   if (ClientResponse.Status.BAD_REQUEST.equals(response.getClientResponseStatus())) {
     final String body = getResponseBody(response);
     response.bufferEntity();
     ErrorResponse errorResponse = null;
     try {
       errorResponse = response.getEntity(ErrorResponse.class);
     } catch (Exception ignore) {
       // most probably we do not have an error response
     }
     if (errorResponse != null) {
       // convert them to hide stupid "old" REST model, and not have it leak out
       final List<ErrorMessage> errors = Lists.newArrayList();
       for (org.sonatype.nexus.client.internal.msg.ErrorMessage message :
           errorResponse.getErrors()) {
         errors.add(
             new NexusClientErrorResponseException.ErrorMessage(
                 message.getId(), message.getMsg()));
       }
       throw new NexusClientErrorResponseException(
           response.getClientResponseStatus().getReasonPhrase(), body, errors);
     }
   }
 }
 private void throwIf400(final ClientResponse response) {
   if (ClientResponse.Status.BAD_REQUEST.equals(response.getClientResponseStatus())) {
     throw new NexusClientBadRequestException(
         response.getClientResponseStatus().getReasonPhrase(), getResponseBody(response));
   }
 }