function xmlrpc_server_server_error in Services 6.2
Same name and namespace in other branches
- 5 servers/xmlrpc_server/xmlrpc_server.module \xmlrpc_server_server_error()
- 6 servers/xmlrpc_server/xmlrpc_server.module \xmlrpc_server_server_error()
- 7 servers/xmlrpc_server/xmlrpc_server.module \xmlrpc_server_server_error()
Implementation of hook_server_error(). Takes the error message and wraps it into an XMLRPC error object.
Parameters
string $message: The error message.
int $code: Optional. An error code, these should map to the applicable http error codes as closely as possible.
Return value
An error as specified by the XMLRPC server.
See also
File
- servers/
xmlrpc_server/ xmlrpc_server.module, line 68 - Enable XML-RPC for services module.
Code
function xmlrpc_server_server_error($message, $code = 0) {
if (!is_array($message)) {
$message = (array) $message;
}
$message = implode(' ', $message);
if ($code === 0) {
$matches = array();
if (preg_match("/\\#(\\d+)/", $message, $matches)) {
$code = $matches[1];
}
else {
$code = 1;
}
}
return xmlrpc_error($code, strip_tags($message));
}