From eef25687e5f7c7e201309a740454ca55e629bd74 Mon Sep 17 00:00:00 2001 From: Jitendra Purohit Date: Mon, 20 Jan 2020 11:26:47 +0530 Subject: [PATCH] Add user friendly error message on merge error --- CRM/Contact/Form/Merge.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/CRM/Contact/Form/Merge.php b/CRM/Contact/Form/Merge.php index 326a035508..2c3d2cb35c 100644 --- a/CRM/Contact/Form/Merge.php +++ b/CRM/Contact/Form/Merge.php @@ -87,11 +87,16 @@ class CRM_Contact_Form_Merge extends CRM_Core_Form { if (!$this->_rgid) { // Unset browse URL as we have come from the search screen. $browseUrl = ''; - $this->_rgid = civicrm_api3('RuleGroup', 'getvalue', [ - 'contact_type' => $this->_contactType, - 'used' => 'Supervised', - 'return' => 'id', - ]); + try { + $this->_rgid = civicrm_api3('RuleGroup', 'getvalue', [ + 'contact_type' => $this->_contactType, + 'used' => 'Supervised', + 'return' => 'id', + ]); + } + catch (Exception $e) { + throw new CRM_Core_Exception(ts('There is no Supervised dedupe rule configured for contact type %1.', [1 => $this->_contactType])); + } } $this->assign('browseUrl', $browseUrl); if ($browseUrl) { -- 2.25.1