diff --git a/arches_orm/view_models/resources.py b/arches_orm/view_models/resources.py index 6c5ee2d..45dc926 100644 --- a/arches_orm/view_models/resources.py +++ b/arches_orm/view_models/resources.py @@ -1,5 +1,7 @@ import uuid +import logging from collections import UserList +from arches.app.models.resource import Resource from ._base import ViewModel, ResourceInstanceViewModel @@ -39,7 +41,16 @@ def append(self, item: str | uuid.UUID | ResourceInstanceViewModel): resource_instance_id = item["resourceId"] # TODO: why no error on else? - value, _, __, ___ = self._make_ri_cb(resource_instance or resource_instance_id) + try: + value, _, __, ___ = self._make_ri_cb(resource_instance or resource_instance_id) + except Resource.DoesNotExist as exc: + logging.error( + "Tried to load %s for %s but could not: %s", + str(resource_instance or resource_instance_id), + str(self._parent_wkri.id if self._parent_wkri else "(unknown)"), + str(exc) + ) + value = None if not value: raise RuntimeError(f"Could not append {item} to resource list within {self._parent_wkri}")