From 373a49c5e7e86e25f2c8ad73b23ff67be038bca7 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Tue, 21 Feb 2023 17:28:32 +1300 Subject: [PATCH] Update Import fix to leverage the exception --- ext/civiimport/Civi/BAO/Import.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ext/civiimport/Civi/BAO/Import.php b/ext/civiimport/Civi/BAO/Import.php index 2a7e807da7..95b7e1163d 100644 --- a/ext/civiimport/Civi/BAO/Import.php +++ b/ext/civiimport/Civi/BAO/Import.php @@ -12,6 +12,7 @@ namespace Civi\BAO; use Civi\Api4\UserJob; +use Civi\Core\Exception\DBQueryException; use CRM_Civiimport_ExtensionUtil as E; use CRM_Core_BAO_CustomValueTable; use CRM_Core_DAO; @@ -206,8 +207,11 @@ class Import extends CRM_Core_DAO { try { $result = CRM_Core_DAO::executeQuery("SHOW COLUMNS FROM $tableName"); } - catch (\PEAR_Exception $e) { - throw new CRM_Core_Exception('Import table no longer exists'); + catch (DBQueryException $e) { + if ($e->getSQLErrorCode() === 1146) { + throw new CRM_Core_Exception('Import table no longer exists'); + } + throw $e; } $userFieldIndex = 0; while ($result->fetch()) { -- 2.25.1