private static void throwHttpStatusError(HttpURLConnection connection,
                                           RequestImpl request,
                                           RequestBuilderImpl builder,
                                           int responseCode) throws IOException {
    String message = null;
    if (responseCode == CUSTOM_ERROR_CODE) {
      message = connection.getHeaderField("Error-Message");
    }
    if ((message == null || message.isEmpty()) && builder.myIsReadResponseOnError) {
      message = request.readError(connection);
    }
    if (message == null || message.isEmpty()) {
      message = IdeCoreBundle.message("error.connection.failed.status", responseCode);
    }
    connection.disconnect();
    throw new HttpStatusException(message, responseCode, requireNonNullElse(request.myUrl, "Empty URL"));
  }
private static void throwHttpStatusError(HttpURLConnection connection,
                                           RequestImpl request,
                                           RequestBuilderImpl builder,
                                           int responseCode)