code: public RepositoryException toRepositoryException(Throwable e) {
          RepositoryException re = transformIntoRepositoryException(e);
          if (re != null) {
              return re;
          }
  
          Throwable cause = e.getCause();
          if (cause != null) {
              re = transformIntoRepositoryException(cause);
              if (re != null) {
                  return re;
              }
          } else {
              cause = e;
          }
  
          return new RepositoryException(cause);
      }
docs: Transforms the given throwable into an appropriate repository
  exception. If it already is a repository exception, it is simply casted.
  
  @param e required exception to transform
  @return RepositoryException, never null