diff --git a/includes/FeedsImporter.inc b/includes/FeedsImporter.inc index 2ba2aea6a3d6f041057b37653c8d3b72a56960b2..19861053f3f86aa67b3dc0e38df061e6e1ad73b5 100644 --- a/includes/FeedsImporter.inc +++ b/includes/FeedsImporter.inc @@ -73,15 +73,12 @@ class FeedsImporter extends FeedsConfigurable { * @return * FEEDS_BATCH_COMPLETE if complete, a float between 0 and 1 indicating * progress otherwise. + * + * @throws + * Throws Exception if an error occurs when expiring items. */ public function expire($time = NULL) { - try { - return $this->processor->expire($time); - } - catch (Exception $e) { - drupal_set_message($e->getMessage(), 'error'); - return FEEDS_BATCH_COMPLETE; - } + return $this->processor->expire($time); } /** @@ -96,6 +93,9 @@ class FeedsImporter extends FeedsConfigurable { * @return * FEEDS_BATCH_COMPLETE if complete, a float between 0 and 1 indicating * progress otherwise. + * + * @throws + * Throws Exception if an error occurs working off the job. */ public function work($job) { if ($this->export_type == FEEDS_EXPORT_NONE) { diff --git a/includes/FeedsScheduler.inc b/includes/FeedsScheduler.inc index 82bea271d7075e75df418303fd1872c66dd2991e..7adebec5261a22d19dcb2779a5567e0a0eeb38ba 100644 --- a/includes/FeedsScheduler.inc +++ b/includes/FeedsScheduler.inc @@ -165,6 +165,7 @@ class FeedsScheduler implements FeedsSchedulerInterface { } catch (Exception $e) { watchdog('FeedsScheduler', $e->getMessage(), array(), WATCHDOG_ERROR); + $this->finished($job); } // Make sure that job is not scheduled after this method has executed. $this->unschedule($job); diff --git a/includes/FeedsSource.inc b/includes/FeedsSource.inc index c0191e8f606e51a5039644529f500a9857390f30..320a3643ff22a1a07990956e23cd57de03186a2f 100644 --- a/includes/FeedsSource.inc +++ b/includes/FeedsSource.inc @@ -108,8 +108,8 @@ class FeedsSource extends FeedsConfigurable { * Lock a source before importing by using FeedsSource::lock(), after * importing, release with FeedsSource::release(). * - * @todo Iron out and document potential Exceptions. - * @todo catch exceptions outside of import(), clear() and expire(). + * @throws + * Throws Exception if an error occurs when importing. */ public function import() { try { @@ -125,8 +125,8 @@ class FeedsSource extends FeedsConfigurable { } catch (Exception $e) { unset($this->batch); - $result = FEEDS_BATCH_ACTIVE; - drupal_set_message($e->getMessage(), 'error'); + $this->save(); + throw $e; } $this->save(); return $result; @@ -134,6 +134,9 @@ class FeedsSource extends FeedsConfigurable { /** * Remove all items from a feed. + * + * @throws + * Throws Exception if an error occurs when clearing. */ public function clear() { try { @@ -149,8 +152,8 @@ class FeedsSource extends FeedsConfigurable { } catch (Exception $e) { unset($this->batch); - $result = FEEDS_BATCH_COMPLETE; - drupal_set_message($e->getMessage(), 'error'); + $this->save(); + throw $e; } $this->save(); return $result;