How can I pass script execution errors to the XMLRPC response so I don’t get a Fault Exception?
Maybe I’m not setting this up right:
In the XMLRPC server I’m adding Zend_XmlRpc_Server_Fault::attachFaultException('Exception'); like this:
Zend_XmlRpc_Server_Fault::attachFaultException('Exception');
$server = new Zend_XmlRpc_Server();
But I still get a Fault Exception:
Fault Exception:\n651Failed to parse response
How can I pass the script execution errors to the response?
I’ve also tried to set this with no luck:
error_reporting(E_ALL);
ini_set("display_errors",1);
ini_set("xmlrpc_errors",1);
Docs: http://php.net/manual/en/errorfunc.configuration.php
Example XMLRPC error when script has errors:
Fault Exception:\n651Failed to parse response
Example of when script has errors:
Fatal error: Call to undefined method
Both are from the same script error, but I need the XMLRPC to display the Fatal error message in the response instead of giving the failed to parse response.
You can use the set_error_handler() function to intercept a script error and instead throw an ErrorException:
So when you call Zend_XmlRpc_Server::handle():
Edit: Example #1 from the ErrorException page is wrong. Use the version in this answer instead.