diff --git a/CRM/Iats/iATSServiceRequest.php b/CRM/Iats/iATSServiceRequest.php index 3b61d73b..7359eea1 100644 --- a/CRM/Iats/iATSServiceRequest.php +++ b/CRM/Iats/iATSServiceRequest.php @@ -220,17 +220,20 @@ public function request($credentials, $request_params) { } } catch (SoapFault $exception) { - // always log soap faults to the CiviCRM error log - CRM_Core_Error::debug_var('SoapFault Exception', $exception); + // always log soap fault codes to the CiviCRM error log CRM_Core_Error::debug_var('SoapFault Code',$exception->faultcode); CRM_Core_Error::debug_var('SoapFault String',$exception->faultstring); - if (!empty($this->options['debug']) && !empty($soapClient)) { - $response_log = "\n HEADER:\n"; - $response_log .= $soapClient->__getLastResponseHeaders(); - $response_log .= "\n BODY:\n"; - $response_log .= $soapClient->__getLastResponse(); - $response_log .= "\n BODYEND:\n"; - CRM_Core_Error::debug_var('Raw Response', $response_log); + // extra logging if debugging + if (!empty($this->options['debug'])) { + CRM_Core_Error::debug_var('SoapFault Exception', $exception); + if (!empty($soapClient)) { + $response_log = "\n HEADER:\n"; + $response_log .= $soapClient->__getLastResponseHeaders(); + $response_log .= "\n BODY:\n"; + $response_log .= $soapClient->__getLastResponse(); + $response_log .= "\n BODYEND:\n"; + CRM_Core_Error::debug_var('Raw Response', $response_log); + } } return FALSE; }