diff --git a/modules/salesforce_pull/src/Plugin/QueueWorker/PullBase.php b/modules/salesforce_pull/src/Plugin/QueueWorker/PullBase.php index fd0d5d4409a917cc4ea7cca4db5a7c37dbe98181..df96ffa7196e2de94b3fde861f7f663cdf927974 100644 --- a/modules/salesforce_pull/src/Plugin/QueueWorker/PullBase.php +++ b/modules/salesforce_pull/src/Plugin/QueueWorker/PullBase.php @@ -101,7 +101,7 @@ abstract class PullBase extends QueueWorkerBase implements ContainerFactoryPlugi * \Drupal\salesforce_mapping\MappingConstants::SALESFORCE_MAPPING_SYNC_SF_CREATE * on successful update or create, NULL otherwise. * - * @throws \Exception + * @throws \Drupal\salesforce_pull\PullException */ public function processItem($item) { // @codingStandardsIgnoreLine $sf_object = $item->getSobject(); @@ -145,7 +145,7 @@ abstract class PullBase extends QueueWorkerBase implements ContainerFactoryPlugi * \Drupal\salesforce_mapping\MappingConstants::SALESFORCE_MAPPING_SYNC_SF_UPDATE * on successful update, NULL otherwise. * - * @throws \Exception + * @throws \Drupal\salesforce_pull\PullException */ protected function updateEntity(SalesforceMappingInterface $mapping, MappedObjectInterface $mapped_object, SObject $sf_object, $force_pull = FALSE) { if (!$mapping->checkTriggers([MappingConstants::SALESFORCE_MAPPING_SYNC_SF_UPDATE])) { @@ -237,7 +237,7 @@ abstract class PullBase extends QueueWorkerBase implements ContainerFactoryPlugi ->save(); // Throwing a new exception keeps current item in cron queue. - throw $e; + throw new PullException(0, '', 0, $e); } } @@ -254,7 +254,7 @@ abstract class PullBase extends QueueWorkerBase implements ContainerFactoryPlugi * \Drupal\salesforce_mapping\MappingConstants::SALESFORCE_MAPPING_SYNC_SF_CREATE * on successful create, NULL otherwise. * - * @throws \Exception + * @throws \Drupal\salesforce_pull\PullException */ protected function createEntity(SalesforceMappingInterface $mapping, SObject $sf_object) { if (!$mapping->checkTriggers([MappingConstants::SALESFORCE_MAPPING_SYNC_SF_CREATE])) { @@ -336,7 +336,7 @@ abstract class PullBase extends QueueWorkerBase implements ContainerFactoryPlugi catch (\Exception $e) { $this->eventDispatcher->dispatch(new SalesforceNoticeEvent($e, 'Pull-create failed for Salesforce Object ID: %sfobjectid', ['%sfobjectid' => (string) $sf_object->id()]), SalesforceEvents::WARNING); // Throwing a new exception to keep current item in cron queue. - throw $e; + throw new PullException(0, '', 0, $e); } } diff --git a/modules/salesforce_pull/src/PullException.php b/modules/salesforce_pull/src/PullException.php index afa0cd4b9a2d3f628f2eebdb5b8d702ddcd32fb2..11fb6c5cfd7fce16d59003a50fc784e04fffe22c 100644 --- a/modules/salesforce_pull/src/PullException.php +++ b/modules/salesforce_pull/src/PullException.php @@ -2,11 +2,12 @@ namespace Drupal\salesforce_pull; +use Drupal\Core\Queue\DelayedRequeueException; use Drupal\salesforce\Exception; /** * Pull exception. */ -class PullException extends Exception { +class PullException extends DelayedRequeueException { }