// Get contact id to format common data in update/fill mode,
// prioritising a dedupe rule check over an external_identifier check, but falling back on ext id.
if ($this->_updateWithId && empty($params['id'])) {
- $possibleMatches = $this->getPossibleContactMatches($params);
+ try {
+ $possibleMatches = $this->getPossibleContactMatches($params);
+ }
+ catch (CRM_Core_Exception $e) {
+ $errorMessage = $e->getMessage();
+ array_unshift($values, $errorMessage);
+
+ $importRecordParams = array(
+ $statusFieldName => 'ERROR',
+ "${statusFieldName}Msg" => $errorMessage
+ );
+ $this->updateImportRecord($values[count($values) - 1], $importRecordParams);
+ return CRM_Import_Parser::ERROR;
+ }
foreach ($possibleMatches as $possibleID) {
$params['id'] = $formatted['id'] = $possibleID;
}