diff --git a/VERSIONS_HOTLINE/38320 b/VERSIONS_HOTLINE/38320
new file mode 100644
index 0000000000000000000000000000000000000000..2f3db3edf78ebb4c5585d6fe01149dc7a7574304
--- /dev/null
+++ b/VERSIONS_HOTLINE/38320
@@ -0,0 +1 @@
+ - ticket #38320 : Cosmogramme : Ajout d'une gestion d'erreur sur l'execution des différentes phases
diff --git a/cosmogramme/php/integration/integration_phase.php b/cosmogramme/php/integration/integration_phase.php
index 3927cb0326103cdd5cab7b38eb43ce29f86ef810..db3877a85afa0eb20ff6f2eda89e83cbb5970fcc 100644
--- a/cosmogramme/php/integration/integration_phase.php
+++ b/cosmogramme/php/integration/integration_phase.php
@@ -46,9 +46,7 @@ function startIntegrationPhase($name) {
 	$current_chrono->backToLegacyState($chrono, $chrono_fichier, $chrono100notices);
 	$new_phase->backToLegacyState($phase, $phase_data, $mode_cron, $reprise, $compteur);
 
-
 	if (!$mode_cron && $requested_phase->isTimeOut())
 		sauveContexte();
 }
-
 ?>
\ No newline at end of file
diff --git a/library/Class/Cosmogramme/Integration/PhaseAbstract.php b/library/Class/Cosmogramme/Integration/PhaseAbstract.php
index e7d2935c27d167c01d5d8dbc5806c0694f732c6d..7f74223fd1fa11c3745231c90df20041ca061bea 100644
--- a/library/Class/Cosmogramme/Integration/PhaseAbstract.php
+++ b/library/Class/Cosmogramme/Integration/PhaseAbstract.php
@@ -23,8 +23,13 @@
 abstract class Class_Cosmogramme_Integration_PhaseAbstract {
   use Trait_TimeSource, Trait_StaticFileSystem, Trait_Translator, Trait_MemoryCleaner;
 
-  protected $_label = '';
-  protected $_phase, $_log, $_printer, $_chrono, $_is_time_out;
+  protected $_label = '',
+    $_phase,
+    $_log,
+    $_printer,
+    $_chrono,
+    $_is_time_out,
+    $_db_reset = true;
 
 
   public function __construct($phase, $log, $chrono) {
@@ -83,7 +88,14 @@ abstract class Class_Cosmogramme_Integration_PhaseAbstract {
 
     $this->_printLabel();
 
-    $this->_execute();
+    try {
+      $this->_execute();
+    } catch (Exception $e) {
+      $this->_log->ecrire('<p class="rouge">' . sprintf('Erreur lors de l\'execution de la phase %s : </br>%s',
+                                                        $this->_label,
+                                                        $e->getMessage()) . '</p>');
+      $this->_cleanMemory();
+    }
 
     return $this->_phase;
   }
@@ -160,4 +172,11 @@ abstract class Class_Cosmogramme_Integration_PhaseAbstract {
     gc_collect_cycles();
     return $this;
   }
+
+
+  /** @category testing */
+  public function noDbReset() {
+    $this->_db_reset = false;
+    return $this;
+  }
 }
\ No newline at end of file
diff --git a/library/Class/Cosmogramme/Integration/PhaseBatchs.php b/library/Class/Cosmogramme/Integration/PhaseBatchs.php
index 8bb8714e42e16a16365b50f96011055f5cc2e77e..56106347c28881d061e6e749f352ff6479761d9d 100644
--- a/library/Class/Cosmogramme/Integration/PhaseBatchs.php
+++ b/library/Class/Cosmogramme/Integration/PhaseBatchs.php
@@ -44,6 +44,8 @@ class Class_Cosmogramme_Integration_PhaseBatchs
 
       $this->_resetHttpClient()
            ->_runOne($batch);
+
+      $this->_cleanMemory();
     }
   }
 
diff --git a/library/Class/Cosmogramme/Integration/PhaseItemFacets.php b/library/Class/Cosmogramme/Integration/PhaseItemFacets.php
index 1c40d36af5d451131ee267fcb82902a57dd4932b..829bef1673fc8da0b04a03111bb78b29f8620408 100644
--- a/library/Class/Cosmogramme/Integration/PhaseItemFacets.php
+++ b/library/Class/Cosmogramme/Integration/PhaseItemFacets.php
@@ -39,6 +39,8 @@ class Class_Cosmogramme_Integration_PhaseItemFacets
   public function _execute() {
     while ($records = Class_Notice::findAllAfter($this->_getData('pointeur_notice'),
                                                  $this->_getData('pointeur'))) {
+      if ($this->isTimeOut())
+        return $this->_phase;
 
       if (0 == ($this->_getData('nombre') % 100))
         $this->_log->ecrire('<span class="vert"> ' . $this->_getData('nombre') . ' records updated </span>');
@@ -52,6 +54,7 @@ class Class_Cosmogramme_Integration_PhaseItemFacets
       $this->runUpdateForRecords($records);
 
       $this->_resetDbConnection();
+      $this->_cleanMemory();
     }
 
     Class_CosmoVar::setValueOf('date_maj_facettes', $this->_last_update_date);
@@ -121,12 +124,4 @@ class Class_Cosmogramme_Integration_PhaseItemFacets
   protected function _wasRunning() {
     return $this->_getData('pointeur_notice') > 0;
   }
-
-
-  /** @category testing */
-  public function noDbReset() {
-    $this->_db_reset = false;
-    return $this;
-  }
 }
-?>
\ No newline at end of file
diff --git a/library/Class/Cosmogramme/Integration/PhaseOnDataSource.php b/library/Class/Cosmogramme/Integration/PhaseOnDataSource.php
index c95a715ac56c486db59f119416e46093dde947ee..ff2634035af6ca41518af06480a51ec6b1d259d3 100644
--- a/library/Class/Cosmogramme/Integration/PhaseOnDataSource.php
+++ b/library/Class/Cosmogramme/Integration/PhaseOnDataSource.php
@@ -30,6 +30,7 @@ abstract class Class_Cosmogramme_Integration_PhaseOnDataSource extends Class_Cos
         return $this->_phase;
 
       $this->_runOne($integration);
+      $this->_cleanMemory();
     }
 
     $this->_setData('pointeur', 0);
diff --git a/library/Class/Cosmogramme/Integration/PhasePseudoRecord.php b/library/Class/Cosmogramme/Integration/PhasePseudoRecord.php
index 8e91dc3e70a4e7c4f3421f4b1e3e129804557e80..3ead13c40dc59b242cb8867285249f7a2300f00b 100644
--- a/library/Class/Cosmogramme/Integration/PhasePseudoRecord.php
+++ b/library/Class/Cosmogramme/Integration/PhasePseudoRecord.php
@@ -54,6 +54,7 @@ abstract class Class_Cosmogramme_Integration_PhasePseudoRecord
         return;
 
       $this->_runPage($models);
+      $this->_cleanMemory();
     }
 
     $this->_summarize();
diff --git a/library/Class/Cosmogramme/Integration/PhaseReviews.php b/library/Class/Cosmogramme/Integration/PhaseReviews.php
index 0492474e46662dceb6f5928e19f1eea3a112affd..6a465b155e7bd19f03de2c3f64cfda24c559431d 100644
--- a/library/Class/Cosmogramme/Integration/PhaseReviews.php
+++ b/library/Class/Cosmogramme/Integration/PhaseReviews.php
@@ -23,7 +23,6 @@ class Class_Cosmogramme_Integration_PhaseReviews extends Class_Cosmogramme_Integ
   const MY_ID=7.5;
 
   protected $_label = 'Reviews attachments';
-  protected $_db_reset=true;
 
   public function __construct($phase, $log, $chrono) {
     parent::__construct($phase, $log, $chrono);
@@ -52,7 +51,9 @@ class Class_Cosmogramme_Integration_PhaseReviews extends Class_Cosmogramme_Integ
   public function _execute() {
     $page = 1;
     while ($records = Class_AvisNotice::findAllBy(['order' => 'id',
-                                                   'limitPage' => [$page, 500]])) {
+                                                   'limitPage' => [$page, 100]])) {
+      if ($this->isTimeOut())
+        return $this->_phase;
 
       if ($this->_log && (0 == ($this->_getData('nombre') % 100)))
         $this->_log->ecrire('<span class="vert"> ' . $this->_getData('nombre') . ' avis mis à jour </span>');
@@ -60,7 +61,7 @@ class Class_Cosmogramme_Integration_PhaseReviews extends Class_Cosmogramme_Integ
       $this->runUpdateForRecords($records);
 
       $this->_resetDbConnection();
-
+      $this->_cleanMemory();
       $page++;
     }
 
@@ -76,7 +77,6 @@ class Class_Cosmogramme_Integration_PhaseReviews extends Class_Cosmogramme_Integ
 
       $this->_log->ecrire($msg);
     }
-
   }
 
 
@@ -97,23 +97,4 @@ class Class_Cosmogramme_Integration_PhaseReviews extends Class_Cosmogramme_Integ
     $this->_incrementData('nombre');
 
   }
-
-  /** @category testing */
-  public function noDbReset() {
-    $this->_db_reset = false;
-    return $this;
-  }
-
-  protected function _resetDbConnection() {
-    if (!$this->_db_reset)
-      return $this;
-
-    Storm_Model_Abstract::unsetLoaders();
-    Zend_Db_Table::getDefaultAdapter()->closeConnection();
-    setupDatabase(loadConfig());
-    gc_collect_cycles();
-    return $this;
-  }
-
-
 }
\ No newline at end of file
diff --git a/tests/library/Class/Cosmogramme/Integration/PhaseItemFacetsTest.php b/tests/library/Class/Cosmogramme/Integration/PhaseItemFacetsTest.php
index e9557875b50f7b20270c61114f2b808f12d4faf9..d7b9cc1f40410ee8ce62f9402dbcad800feab99e 100644
--- a/tests/library/Class/Cosmogramme/Integration/PhaseItemFacetsTest.php
+++ b/tests/library/Class/Cosmogramme/Integration/PhaseItemFacetsTest.php
@@ -25,6 +25,7 @@ abstract class PhaseItemFacetsTestCase extends Class_Cosmogramme_Integration_Pha
     parent::setUp();
 
     $this->_phase = $this->_buildPhase('ItemFacets')
+                         ->setMemoryCleaner(function() {})
                          ->noDbReset()
                          ->run();
   }
@@ -87,7 +88,7 @@ class PhaseItemFacetsExpectedPreviousPhaseTest extends PhaseItemFacetsTestCase {
 
   /** @test */
   public function lastFacetsUpdateDateShouldBeSet() {
-    $this->assertNotEquals('', Class_CosmoVar::getValueOf('date_maj_facettes'));
+    $this->assertNotEmpty(Class_CosmoVar::getValueOf('date_maj_facettes'));
   }
 }
 
@@ -111,4 +112,27 @@ abstract class PhaseItemFacetsCallbackTest extends PhaseItemFacetsTestCase {
                                 ['id' => 1,
                                  'date_maj' => '2015-04-05 15:08:34'])]);
   }
+}
+
+
+
+class PhaseItemFacetsExpectedExceptionPhaseTest extends PhaseItemFacetsTestCase {
+  protected function _getPreviousPhase() {
+    return (new Class_Cosmogramme_Integration_Phase(4))
+      ->beCron();
+  }
+
+
+  protected function _prepareFixtures() {
+    $this
+      ->onLoaderOfModel('Class_Notice')
+      ->whenCalled('findAllAfter')
+      ->answers('error');
+  }
+
+
+  /** @test */
+  public function logShouldContainsPhaseLabel() {
+    $this->assertLogContains('<h4>Mise à jour des facettes exemplaires</h4><span class="vert"> 0 records updated </span><p class="rouge">Erreur lors de l\'execution de la phase Mise à jour des facettes exemplaires : </br>Invalid argument supplied for foreach()</p>');
+  }
 }
\ No newline at end of file
diff --git a/tests/library/Class/Cosmogramme/Integration/PhaseNoticeTestCase.php b/tests/library/Class/Cosmogramme/Integration/PhaseNoticeTestCase.php
index 7095a3c7a522e35e6ca13893fe7b320e97a33da1..0c8fd99ce43e6676e2f89a8a0ce12f9b11be1819 100644
--- a/tests/library/Class/Cosmogramme/Integration/PhaseNoticeTestCase.php
+++ b/tests/library/Class/Cosmogramme/Integration/PhaseNoticeTestCase.php
@@ -28,7 +28,9 @@ class PhaseNoticeTestCase extends Class_Cosmogramme_Integration_PhaseTestCase {
     $this->fixture('Class_CosmoVar',
                    ['id' => 'unimarc_zone_matiere', 'valeur' => '610a']);
 
-    $this->_phase = $this->_buildPhase('Notice')->run();
+    $this->_phase = $this->_buildPhase('Notice')
+                         ->setMemoryCleaner(function() {})
+                         ->run();
     Class_Notice::clearCache();
     Class_Exemplaire::clearCache();
   }
diff --git a/tests/library/Class/Cosmogramme/Integration/PhasePanierTest.php b/tests/library/Class/Cosmogramme/Integration/PhasePanierTest.php
index e60477f5be71db5377a1e7453d30e07c148008eb..443763cea4ed558d0b205725eb0d54f391d52acc 100644
--- a/tests/library/Class/Cosmogramme/Integration/PhasePanierTest.php
+++ b/tests/library/Class/Cosmogramme/Integration/PhasePanierTest.php
@@ -61,8 +61,9 @@ abstract class PhasePanierTestCase extends Class_Cosmogramme_Integration_PhaseTe
     parent::setUp();
 
     $this->_phase = $this->_buildPhase('Panier')
-      ->setPrinter($this->_printer)
-      ->run();
+                         ->setMemoryCleaner(function() {})
+                         ->setPrinter($this->_printer)
+                         ->run();
   }
 }
 
diff --git a/tests/library/Class/Cosmogramme/Integration/PhasePatronsTest.php b/tests/library/Class/Cosmogramme/Integration/PhasePatronsTest.php
index cd123f5255169a8b53c38d23bcc25fa8f497db22..cdcd4dcbe7dce15ef6b83f757cd6cdad522e0162 100644
--- a/tests/library/Class/Cosmogramme/Integration/PhasePatronsTest.php
+++ b/tests/library/Class/Cosmogramme/Integration/PhasePatronsTest.php
@@ -68,6 +68,7 @@ abstract class PhasePatronsTestCase extends Class_Cosmogramme_Integration_PhaseT
   public function setUp() {
     parent::setUp();
     $this->_phase = $this->_buildPhase('Patrons')
+                         ->setMemoryCleaner(function() {})
                          ->setPrinter($this->_printer);
   }
 }
diff --git a/tests/library/Class/Cosmogramme/Integration/PhaseReservationTest.php b/tests/library/Class/Cosmogramme/Integration/PhaseReservationTest.php
index 87e43bc6d98bb7a18365b4a2059203bc71207dc8..083363609a6f0a3cf21a38ac6a6ed89036b1bd6d 100644
--- a/tests/library/Class/Cosmogramme/Integration/PhaseReservationTest.php
+++ b/tests/library/Class/Cosmogramme/Integration/PhaseReservationTest.php
@@ -27,7 +27,8 @@ abstract class PhaseReservationTestCase extends Class_Cosmogramme_Integration_Ph
     parent::setUp();
 
     $this->_phase = $this->_buildPhase('Reservation')
-      ->run();
+                         ->setMemoryCleaner(function() {})
+                         ->run();
   }
 
 
diff --git a/tests/library/Class/Cosmogramme/Integration/PhaseReviewsTest.php b/tests/library/Class/Cosmogramme/Integration/PhaseReviewsTest.php
index a5f97cd83d4407c8b0a289b39011b2eb744a03b2..3e38c9ecb4e09fa5183959ed8db976a35c9b0950 100644
--- a/tests/library/Class/Cosmogramme/Integration/PhaseReviewsTest.php
+++ b/tests/library/Class/Cosmogramme/Integration/PhaseReviewsTest.php
@@ -25,6 +25,7 @@ abstract class PhaseReviewsTestCase extends Class_Cosmogramme_Integration_PhaseT
     parent::setUp();
 
     $this->_phase = $this->_buildPhase('Reviews')
+                         ->setMemoryCleaner(function() {})
                          ->noDbReset()
                          ->run();
   }