From: Tim Otten Date: Tue, 17 May 2022 21:32:19 +0000 (-0700) Subject: (REF) Kernel::runSafe - When decoding exceptions, check API_Exception before PEAR_Exc... X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=b538d8e045da23d6c0097c04f52558ba4e70ab7b;p=civicrm-core.git (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 --- 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); }