public void handleError()

in openstack-poppy/src/main/java/org/jclouds/openstack/poppy/v1/handlers/PoppyErrorHandler.java [30:51]


   public void handleError(HttpCommand command, HttpResponse response) {
      // it is important to always read fully and close streams
      byte[] data = closeClientButKeepContentStream(response);
      Exception exception;

      if (data == null) {
         exception = new HttpResponseException(command, response);
      } else {
         exception = new HttpResponseException(command, response, new String(data));
      }

      switch (response.getStatusCode()) {
         case 401:
            exception = new AuthorizationException(exception.getMessage(), exception);
            break;
         case 409:
            exception = new IllegalStateException(exception.getMessage(), exception);
            break;
      }

      command.setException(exception);
   }