code: public static Throwable getRootCause(Throwable e) {
      while (e.getCause() != null && !(e.getCause() instanceof StatusRuntimeException)) {
        e = e.getCause();
      }
      return e;
    }
docs: Gets the root cause of an exception.
  It stops at encountering gRPC's StatusRuntimeException.
  
  @param e the exception
  @return the root cause