Correct error cases after code reorganization
authorymh <ymh.work@gmail.com>
Mon, 20 Feb 2017 11:43:46 +0100
changeset 518 4864076bf0e3
parent 517 3143195e91b4
child 519 ef3e4841d506
Correct error cases after code reorganization
server/src/app/Console/Commands/ImportCocoonRDF.php
--- a/server/src/app/Console/Commands/ImportCocoonRDF.php	Fri Feb 17 22:01:32 2017 +0100
+++ b/server/src/app/Console/Commands/ImportCocoonRDF.php	Mon Feb 20 11:43:46 2017 +0100
@@ -86,7 +86,7 @@
             $this->error("\nError processing $identifier ($docRdfUrl) : $docType unknown mapper");
             Log::error("Error processing $identifier ($docRdfUrl) : $docType unknown mapper");
             $this->documentCount['unknown'] += 1;
-            continue;
+            return ['unknown', null];
         }
 
         $mapperClass = ImportCocoonRDF::MAPPER_CLASS_MAP[$docType];
@@ -97,6 +97,7 @@
         } catch (\Exception $e) {
             Log::error("Error processing $identifier ($docRdfUrl) : error mapping graph : $e");
             $this->documentCount['error'] += 1;
+            return ['error', null];
         }
         $this->documentCount['all'] += 1;
         $this->documentCount[$docType] = isset($this->documentCount[$docType])?$this->documentCount[$docType]+1:1;
@@ -333,6 +334,11 @@
             //map the doc
             list($docType, $mappedGraphes) = $this->mapDoc($doc, $docUri);
 
+            if($docType === 'unknown' || $docType === 'error') {
+                // The error has been traced in mapDoc
+                continue;
+            }
+
             //merge the result docs
             $this->mergeDocs($docType, $mappedGraphes);