From 35c1c211f7d23962f92823b9634afae6ebfd50fb Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Thu, 10 Jun 2021 07:34:06 +1200 Subject: [PATCH] dev/core#2646 juice up the error a little 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 --- CRM/Core/ManagedEntities.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CRM/Core/ManagedEntities.php b/CRM/Core/ManagedEntities.php index 4c70ce10e8..3ed9c14388 100644 --- a/CRM/Core/ManagedEntities.php +++ b/CRM/Core/ManagedEntities.php @@ -261,7 +261,7 @@ class CRM_Core_ManagedEntities { */ 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]; @@ -481,7 +481,9 @@ class CRM_Core_ManagedEntities { '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'] . ')' : '' + ); } /** -- 2.25.1