On explaining the issue in https://lab.civicrm.org/dev/core/-/issues/2646 not
having the name of the failed entity in the error message seemed like a pain point
*/
public function updateExistingEntity($dao, $todo) {
$policy = CRM_Utils_Array::value('update', $todo, 'always');
- $doUpdate = ($policy == 'always');
+ $doUpdate = ($policy === 'always');
if ($doUpdate) {
$defaults = ['id' => $dao->entity_id];
'params' => $params,
'result' => $result,
]);
- throw new Exception('API error: ' . $result['error_message'] . ' on ' . $entity . '.' . $action);
+ throw new Exception('API error: ' . $result['error_message'] . ' on ' . $entity . '.' . $action
+ . !empty($params['name']) ? '( entity name ' . $params['name'] . ')' : ''
+ );
}
/**