diff --git a/pydatajson/federation.py b/pydatajson/federation.py
index 43e932e..b503d95 100644
--- a/pydatajson/federation.py
+++ b/pydatajson/federation.py
@@ -5,11 +5,13 @@ de la API de CKAN.
 """
 
 from __future__ import print_function
+import logging
 from ckanapi import RemoteCKAN
-from ckanapi.errors import NotFound
+from ckanapi.errors import NotFound, NotAuthorized
 from .ckan_utils import map_dataset_to_package, map_theme_to_group
 from .search import get_datasets
 
+logger = logging.getLogger(__name__)
 
 def push_dataset_to_ckan(catalog, owner_org, dataset_origin_identifier,
                          portal_url, apikey, catalog_id=None,
@@ -250,14 +252,20 @@ def harvest_catalog_to_ckan(catalog, portal_url, apikey, catalog_id,
         Returns:
             str: El id del dataset en el catálogo de destino.
     """
-    dataset_list = dataset_list or [ds['identifier']
-                                    for ds in catalog.datasets]
+    # Evitar entrar con valor falsy
+    if dataset_list is None:
+        dataset_list = [ds['identifier'] for ds in catalog.datasets]
     owner_org = owner_org or catalog_id
     harvested = []
     for dataset_id in dataset_list:
-        harvested_id = harvest_dataset_to_ckan(
-            catalog, owner_org, dataset_id, portal_url, apikey, catalog_id)
-        harvested.append(harvested_id)
+        try:
+            harvested_id = harvest_dataset_to_ckan(
+                catalog, owner_org, dataset_id, portal_url, apikey, catalog_id)
+            harvested.append(harvested_id)
+        except (NotAuthorized, NotFound, KeyError, TypeError) as e:
+            logger.error("Error federando catalogo:"+catalog_id+", dataset:"+dataset_id + "al portal: "+portal_url)
+            logger.error(str(e))
+
     return harvested
 
 

Robustecer el manejo de harvest_catalog_to_ckan()
Hay que corregir 2 problemas:

- En caso de pasar una lista vacía en el dataset list, no se debe federar ningún dataset. Actualmente se federan todos.

-En caso de que alguno de las llamadas a `harvest_dataset_to_ckan()` falle, loggear y continuar con el resto. Actualmente la federación entera del catálogo levanta la excepción.
diff --git a/tests/test_federation.py b/tests/test_federation.py
index fe95079..9d0515f 100644
--- a/tests/test_federation.py
+++ b/tests/test_federation.py
@@ -223,6 +223,13 @@ class PushDatasetTestCase(unittest.TestCase):
             self.assertCountEqual([self.catalog_id+'_'+ds['identifier'] for ds in self.catalog.datasets],
                                   harvested_ids)
 
+    @patch('pydatajson.federation.RemoteCKAN', autospec=True)
+    def test_harvest_catalog_with_empty_list(self, mock_portal):
+        harvested_ids = harvest_catalog_to_ckan(self.catalog, 'portal', 'key', self.catalog_id,
+                                                owner_org='owner', dataset_list=[])
+        mock_portal.assert_not_called()
+        self.assertEqual([], harvested_ids)
+
 
 class RemoveDatasetTestCase(unittest.TestCase):
 

pip install -e .[dev]
parse_log_pytest
requirements.txt
pytest
3.6
requirements.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
attrs==22.2.0
certifi==2021.5.30
chardet==3.0.4
ckanapi==4.0
docopt==0.6.2
et-xmlfile==1.1.0
idna==2.6
importlib-metadata==4.8.3
iniconfig==1.1.1
isodate==0.6.0
jdcal==1.4.1
jsonschema==2.6.0
openpyxl==2.4.11
packaging==21.3
pluggy==1.0.0
py==1.11.0
-e git+https://github.com/datosgobar/pydatajson.git@dae546a739eb2aab1c34b3d8bbb5896fe804e0aa#egg=pydatajson
pyparsing==3.1.4
pytest==7.0.1
python-dateutil==2.6.1
requests==2.18.4
rfc3987==1.3.7
six==1.11.0
tomli==1.2.3
typing_extensions==4.1.1
unicodecsv==0.14.1
Unidecode==0.4.21
urllib3==1.22
zipp==3.6.0

name: pydatajson
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2021.5.30=py36h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.3=he6710b0_2
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - pip=21.2.2=py36h06a4308_0
  - python=3.6.13=h12debd9_1
  - readline=8.2=h5eee18b_0
  - setuptools=58.0.4=py36h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.37.1=pyhd3eb1b0_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - attrs==22.2.0
      - chardet==3.0.4
      - ckanapi==4.0
      - docopt==0.6.2
      - et-xmlfile==1.1.0
      - idna==2.6
      - importlib-metadata==4.8.3
      - iniconfig==1.1.1
      - isodate==0.6.0
      - jdcal==1.4.1
      - jsonschema==2.6.0
      - openpyxl==2.4.11
      - packaging==21.3
      - pluggy==1.0.0
      - py==1.11.0
      - pyparsing==3.1.4
      - pytest==7.0.1
      - python-dateutil==2.6.1
      - requests==2.18.4
      - rfc3987==1.3.7
      - six==1.11.0
      - tomli==1.2.3
      - typing-extensions==4.1.1
      - unicodecsv==0.14.1
      - unidecode==0.04.21
      - urllib3==1.22
      - zipp==3.6.0
prefix: /opt/conda/envs/pydatajson

tests/test_federation.py::PushDatasetTestCase::test_harvest_catalog_with_empty_list
tests/test_federation.py::PushDatasetTestCase::test_dataset_id_is_preserved_if_catalog_id_is_not_passed tests/test_federation.py::PushDatasetTestCase::test_dataset_level_wrappers tests/test_federation.py::PushDatasetTestCase::test_dataset_without_license_sets_notspecified tests/test_federation.py::PushDatasetTestCase::test_harvest_catalog_with_dataset_list tests/test_federation.py::PushDatasetTestCase::test_harvest_catalog_with_no_optional_parametres tests/test_federation.py::PushDatasetTestCase::test_harvest_catalog_with_owner_org tests/test_federation.py::PushDatasetTestCase::test_id_is_created_correctly tests/test_federation.py::PushDatasetTestCase::test_id_is_updated_correctly tests/test_federation.py::PushDatasetTestCase::test_licenses_are_interpreted_correctly tests/test_federation.py::PushDatasetTestCase::test_tags_are_passed_correctly tests/test_federation.py::RemoveDatasetTestCase::test_empty_search_doesnt_call_purge tests/test_federation.py::RemoveDatasetTestCase::test_filter_in_datasets tests/test_federation.py::RemoveDatasetTestCase::test_filter_in_out_datasets tests/test_federation.py::RemoveDatasetTestCase::test_query_one_dataset tests/test_federation.py::RemoveDatasetTestCase::test_query_over_500_datasets tests/test_federation.py::RemoveDatasetTestCase::test_remove_through_filters_and_organization tests/test_federation.py::PushThemeTestCase::test_ckan_portal_is_called_with_correct_parametres tests/test_federation.py::PushThemeTestCase::test_empty_theme_search_raises_exception tests/test_federation.py::PushThemeTestCase::test_function_pushes_theme_by_identifier tests/test_federation.py::PushThemeTestCase::test_function_pushes_theme_by_label tests/test_federation.py::PushCatalogThemesTestCase::test_empty_portal_pushes_every_theme tests/test_federation.py::PushCatalogThemesTestCase::test_full_portal_pushes_nothing tests/test_federation.py::PushCatalogThemesTestCase::test_non_empty_intersection_pushes_missing_themes
pydatajson/federation.py
pydatajson/federation.py