/** * Generate a server fault * * Note that the arguments are reverse to those of Zend_XmlRpc_Server_Fault. * * note: the difference with the Zend server is that we throw a Zend_XmlRpc_Server_Fault exception * with the debuginfo integrated to the exception message when DEBUG >= NORMAL * * If an exception is passed as the first argument, its message and code * will be used to create the fault object if it has been registered via * {@Link registerFaultException()}. * * @param string|Exception $fault * @param string $code XMLRPC Fault Codes * @return Zend_XmlRpc_Server_Fault */ public function fault($fault = null, $code = 404) { //run the zend code that clean/create a xmlrpcfault $xmlrpcfault = parent::fault($fault, $code); //intercept any exceptions and add the errorcode and debuginfo (optional) $actor = null; $details = null; if ($fault instanceof Exception) { //add the debuginfo to the exception message if debuginfo must be returned if (ws_debugging() and isset($fault->debuginfo)) { $details = $fault->debuginfo; } } $fault = new Zend_XmlRpc_Server_Fault($xmlrpcfault); $fault->setCode($xmlrpcfault->getCode()); $fault->setMessage($xmlrpcfault->getMessage() . ' | ERRORCODE: ' . $xmlrpcfault->getCode() . ' | DETAILS: ' . $details); return $fault; }