diff --git a/modules/dkan_harvest/src/Harvester.php b/modules/dkan_harvest/src/Harvester.php index 722337ab97..46ff781d85 100644 --- a/modules/dkan_harvest/src/Harvester.php +++ b/modules/dkan_harvest/src/Harvester.php @@ -4,6 +4,7 @@ use Drupal\dkan_harvest\ETL\Factory; use Drupal\dkan_harvest\ETL\Transform\Transform; +use Drupal\dkan_metastore\Exception\MissingObjectException; /** * Executes harvests. @@ -48,7 +49,14 @@ public function revert(): int { $counter = 0; foreach ($ids as $id) { - $load->removeItem($id); + try { + $load->removeItem($id); + } + // Catch missing datasets without incident, because we wanted them + // removed anyway. + catch (MissingObjectException $exception) { + \Drupal::logger('harvest')->error($exception->getMessage()); + } $this->factory->hashStorage->remove($id); $counter++; }