From 5a73216af17b1203db33767f52ede98dba904eb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20BEAU?= Date: Sun, 19 Oct 2014 23:49:24 +0200 Subject: [PATCH] throw error in the web API if we encountered errors during the import. --- code/Model/Import/Api.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/code/Model/Import/Api.php b/code/Model/Import/Api.php index 82a9895..c53072b 100644 --- a/code/Model/Import/Api.php +++ b/code/Model/Import/Api.php @@ -65,6 +65,11 @@ public function importEntities($entities, $entityType = null, $behavior = null) $this->_api->getDataSourceModel()->setEntities($entities); try { $result = $this->_api->importSource(); + $errorsCount = $this->_api->getErrorsCount(); + if ($errorsCount > 0) { + Mage::throwException("There were {$errorsCount} errors during the import process." . + "Please be aware that valid entities were still imported."); + }; } catch(Mage_Core_Exception $e) { $this->_fault('import_failed', $e->getMessage()); }