XMLRPC 捕获脚本执行错误并将其显示在响应中
如何将脚本执行错误传递给 XMLRPC 响应,这样我就不会收到错误异常?
也许我没有正确设置:
在 XMLRPC 服务器中,我添加 Zend_XmlRpc_Server_Fault::attachFaultException('Exception');
像这样:
Zend_XmlRpc_Server_Fault::attachFaultException('Exception');
$server = new Zend_XmlRpc_Server();
但我仍然收到错误异常:
Fault Exception:\n651Failed to parse response
如何通过脚本执行错误到响应?
我也尝试设置这个但没有运气:
error_reporting(E_ALL);
ini_set("display_errors",1);
ini_set("xmlrpc_errors",1);
文档: http://php.net /manual/en/errorfunc.configuration.php
脚本出现错误时的 XMLRPC 错误示例:
Fault Exception:\n651Failed to parse response
脚本出现错误时的示例:
Fatal error: Call to undefined method
两者都来自同一个脚本错误,但我需要 XMLRPC 在响应而不是给出解析失败的内容 回复。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
可以使用set_error_handler()函数来拦截脚本错误,而是抛出 ErrorException:
所以当你调用Zend_XmlRpc_Server::handle():
编辑: ErrorException 页面中的示例 #1 是错误的。请改用此答案中的版本。
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.