diff --git a/CRM/Core/Payment/PayPalImpl.php b/CRM/Core/Payment/PayPalImpl.php index 21f9fd37b2d1..ad49b89b0212 100644 --- a/CRM/Core/Payment/PayPalImpl.php +++ b/CRM/Core/Payment/PayPalImpl.php @@ -1016,13 +1016,13 @@ public function doTransferCheckout(&$params, $component = 'contribute') { * @param null $url * * @return array|object - * @throws \Exception + * @throws \Civi\Payment\Exception\PaymentProcessorException */ public function invokeAPI($args, $url = NULL) { if ($url === NULL) { if (empty($this->_paymentProcessor['url_api'])) { - CRM_Core_Error::fatal(ts('Please set the API URL. Please refer to the documentation for more details')); + throw new PaymentProcessorException(ts('Please set the API URL. Please refer to the documentation for more details')); } $url = $this->_paymentProcessor['url_api'] . 'nvp'; @@ -1062,16 +1062,9 @@ public function invokeAPI($args, $url = NULL) { $result = self::deformat($response); if (curl_errno($ch)) { - $e = CRM_Core_Error::singleton(); - $e->push(curl_errno($ch), - 0, NULL, - curl_error($ch) - ); - return $e; - } - else { - curl_close($ch); + throw new PaymentProcessorException(ts('Network error') . ' ' . curl_error($ch) . curl_errno($ch), curl_errno($ch)); } + curl_close($ch); $outcome = strtolower(CRM_Utils_Array::value('ack', $result));