diff --git a/CRM/Core/Payment/MJWTrait.php b/CRM/Core/Payment/MJWTrait.php index b7e0808a833f6323c6489ec5a4152f3dd0407be9..8e6089b3fc678cf52fc0b81e6f8d019fcfc37a50 100644 --- a/CRM/Core/Payment/MJWTrait.php +++ b/CRM/Core/Payment/MJWTrait.php @@ -349,14 +349,13 @@ trait CRM_Core_Payment_MJWTrait { /** * Handle an error and notify the user - * @fixme We should not return the message here - we should throw an exception and catch in calling code * * @param string $errorCode * @param string $errorMessage * @param string $bounceURL * - * @return string $errorMessage - * (or statusbounce if URL is specified) + * @throws \Civi\Payment\Exception\PaymentProcessorException + * (or statusbounce if URL is specified) */ private function handleError($errorCode = NULL, $errorMessage = NULL, $bounceURL = NULL) { $errorCode = empty($errorCode) ? '' : $errorCode . ': '; @@ -372,8 +371,7 @@ trait CRM_Core_Payment_MJWTrait { if ($bounceURL) { CRM_Core_Error::statusBounce($message, $bounceURL, $this->getPaymentTypeLabel()); } - // @fixme throw exception instead of returning - return $errorMessage; + throw new PaymentProcessorException($errorMessage, $errorCode); } /**