Skip to content

Commit

Permalink
throw error in the web API if we encountered errors during the import.
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastienbeau authored and danslo committed Oct 19, 2014
1 parent b496122 commit 5a73216
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions code/Model/Import/Api.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand Down

0 comments on commit 5a73216

Please sign in to comment.