code: private static DriverException unwrapAllNodesFailedException(DriverException e) {
      if (e instanceof AllNodesFailedException) {
        AllNodesFailedException noHostAvailable = (AllNodesFailedException) e;
        for (Throwable error : noHostAvailable.getErrors().values()) {
          if (error instanceof QueryConsistencyException || error instanceof UnavailableException) {
            return (DriverException) error;
          }
        }
        // Couldn't find an exploitable error to unwrap: abort.
        throw e;
      }
      // the original exceptional wasn't a NoHostAvailableException: proceed.
      return e;
    }
docs: If the driver was unable to contact any node, it throws an umbrella {@link
  NoNodeAvailableException} containing a map of the actual errors, keyed by host.
  
  <p>This method unwraps this exception, inspects the map of errors, and returns the first
  exploitable {@link DriverException}.
  
  @param e the exception to unwrap.
  @return the unwrapped exception, or the original exception, if it is not an instance of {@link
  NoNodeAvailableException}.
  @throws NoNodeAvailableException the original exception, if it cannot be unwrapped.