Example #1
0
 /**
  * Handles an import exception.
  */
 protected function handleException(FeedInterface $feed, \Exception $exception)
 {
     $feed->finishImport();
     if (!$exception instanceof EmptyFeedException) {
         throw $exception;
     }
 }
Example #2
0
 /**
  * Handles an exception during importing.
  *
  * @param \Drupal\feeds\FeedInterface $feed
  *   The feed.
  * @param \Exception $exception
  *   The exception that was thrown.
  *
  * @throws \Exception
  *   Thrown if $exception is not an instance of EmptyFeedException.
  */
 protected function handleException(FeedInterface $feed, \Exception $exception)
 {
     $feed->finishImport();
     if ($exception instanceof EmptyFeedException) {
         return;
     }
     if ($exception instanceof \RuntimeException) {
         drupal_set_message($exception->getMessage(), 'error');
         return;
     }
     throw $exception;
 }