private static String getMessage(final int numRetries,
    final List<ThrowableWithExtraContext> exceptions) {
    StringBuilder buffer = new StringBuilder("Failed after attempts=");
    buffer.append(numRetries + 1);
    buffer.append(", exceptions:\n");
    for (ThrowableWithExtraContext t : exceptions) {
      buffer.append(t.toString());
      buffer.append("\n");
    }
    return buffer.toString();
  }
Create a new RetriesExhaustedException from the list of prior failures.
@param numRetries How many times we have retried, one less than total attempts
@param exceptions List of exceptions that failed before giving up
hbase-client/src/main/java/org/apache/hadoop/hbase/client/RetriesExhaustedException.java