From b538d8e045da23d6c0097c04f52558ba4e70ab7b Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Tue, 17 May 2022 14:32:19 -0700 Subject: [PATCH] (REF) Kernel::runSafe - When decoding exceptions, check API_Exception before PEAR_Exception API_Exception is narrower, and we may want API_Exception to become a subclass of PEAR_Exception --- Civi/API/Kernel.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Civi/API/Kernel.php b/Civi/API/Kernel.php index 70395abd76..96cc6120fc 100644 --- a/Civi/API/Kernel.php +++ b/Civi/API/Kernel.php @@ -86,12 +86,12 @@ class Kernel { $this->dispatcher->dispatch('civi.api.exception', new ExceptionEvent($e, NULL, $apiRequest, $this)); } - if ($e instanceof \PEAR_Exception) { - $err = $this->formatPearException($e, $apiRequest); - } - elseif ($e instanceof \API_Exception) { + if ($e instanceof \API_Exception) { $err = $this->formatApiException($e, $apiRequest); } + elseif ($e instanceof \PEAR_Exception) { + $err = $this->formatPearException($e, $apiRequest); + } else { $err = $this->formatException($e, $apiRequest); } -- 2.25.1