code: private PublishingException readPublishingException(HttpResponse response) {
          InputStream is = null;
          PublishingException exception;
          try {
              is = response.getEntity().getContent();
              GatewayApiErrorBean error = mapper.reader(GatewayApiErrorBean.class).readValue(is);
              exception = new PublishingException(error.getMessage());
              StackTraceElement[] stack = parseStackTrace(error.getStacktrace());
              if (stack != null) {
                  exception.setStackTrace(stack);
              }
          } catch (Exception e) {
              exception = new PublishingException(e.getMessage(), e);
          } finally {
              IOUtils.closeQuietly(is);
          }
          return exception;
      }
docs: Reads a publishing exception from the response.
  @param response