docs: public static String format(String heading, Collection<ErrorMessage> errorMessages) {
      @SuppressWarnings("resource")
      Formatter fmt = new Formatter().format(heading).format(":%n%n");
      int index = 1;
      boolean displayCauses = getOnlyCause(errorMessages) == null;
  
      for (ErrorMessage errorMessage : errorMessages) {
        fmt.format("%s) %s%n", index++, errorMessage.getMessage());
  
        Throwable cause = errorMessage.getCause();
        if (displayCauses && cause != null) {
          StringWriter writer = new StringWriter();
          cause.printStackTrace(new PrintWriter(writer));
          fmt.format("Caused by: %s", writer.getBuffer());
        }
  
        fmt.format("%n");
      }
  
      if (errorMessages.size() == 1)
        fmt.format("1 error");
      else
        fmt.format("%s errors", errorMessages.size());
  
      return fmt.toString();
    }