You are here

function clients_connection_drupal_services::handleXmlrpcError in Web Service Clients 6.2

Same name and namespace in other branches
  1. 7.3 connections/clients_drupal/clients_drupal.inc \clients_connection_drupal_services::handleXmlrpcError()
  2. 7.2 connections/clients_drupal/clients_drupal.inc \clients_connection_drupal_services::handleXmlrpcError()

Common helper for reacting to an error from an XMLRPC call.

Gets the error from Drupal core's XMLRPC library, logs the error message, and throws an exception, which should be caught by the module making use of the Clients connection API.

3 calls to clients_connection_drupal_services::handleXmlrpcError()
clients_connection_drupal_services_5::callMethodArray in connections/clients_drupal/clients_drupal.inc
Call a remote method with an array of parameters.
clients_connection_drupal_services_6_2::callMethodArray in connections/clients_drupal/clients_drupal.inc
Call a remote method with an array of parameters.
clients_connection_drupal_services_7_3::callMethodArray in connections/clients_drupal/clients_drupal.inc
Call a remote method.

File

connections/clients_drupal/clients_drupal.inc, line 34
Contains classes for Client connections handlers.

Class

clients_connection_drupal_services
Base class for Drupal client connections.

Code

function handleXmlrpcError() {

  // If the remote call resulted in an error, log it and throw an exception.
  $error = xmlrpc_error();
  if (is_object($error)) {
    watchdog('clients', 'Error calling method @method. Error was code @code with message "@message".', array(
      '@method' => $this->method,
      // Technically safe but who knows where this may come from, hence '@'.
      '@code' => $error->code,
      '@message' => $error->message,
    ));
    throw new Exception($error->message, $error->code);
  }
}