将自定义 die() 处理程序注入 mod_perl SOAP 处理程序
我们使用 $server = SOAP::Transport::HTTP::Apache->new; $server->dispatch_with(...)
在这里作为基于 JS 的应用程序的后端。如果底层模块死掉,它会发回一条不错的错误消息,并由 JS 代码显示。
问题是,我想要更详细的消息(例如 Carp::longmess),以及 STDERR 上的硬拷贝。
如何通过最少的代码修改将自定义异常处理程序注入 SOAP::Transport::HTTP::Apache?
(这是一个又大又旧的项目,我们无力重写,尽管老实说它值得重写)。
更新:这是一个示例错误消息:
<soap:Body><soap:Fault>
<faultcode>soap:Server</faultcode><faultstring>Column
'allocation' cannot be null at
/usr/local/lib/perl5/site_perl/5.8.8/Tangram/Storage.pm
line 686. </faultstring></soap:Fault></soap:Body>
我收到一个七巧板错误,但这不太可能是七巧板中的错误,无论如何我需要完整的堆栈跟踪。 OTOH,die 消息进入了 SOAP 消息,这不是正常的 die 操作,因此有一个处理程序某处 - 我想对其进行一些自定义。
We're using a $server = SOAP::Transport::HTTP::Apache->new; $server->dispatch_with(...)
over here as a backend to a JS-based application. Should the underlying module die, it sends back a nice error message that gets displayed by the JS code.
The problem is, I would like more detailed messages (e.g. Carp::longmess), and a hard copy of those on STDERR.
How can I inject a custom exception handler into SOAP::Transport::HTTP::Apache with minimal code modifications?
(This is a large and old project we can't afford to rewrite, though honestly it deserves a rewrite).
UPDATE: here's a sample error message:
<soap:Body><soap:Fault>
<faultcode>soap:Server</faultcode><faultstring>Column
'allocation' cannot be null at
/usr/local/lib/perl5/site_perl/5.8.8/Tangram/Storage.pm
line 686. </faultstring></soap:Fault></soap:Body>
I get a Tangram error but this is unlikely a bug in Tangram and anyway I need a full stack-trace. OTOH, the die message got into a SOAP message which is not a normal die action so there's a handler somewhere -- which I want to customize a bit.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
错误处理程序位于 SOAP::Transport::HTTP::Server::_output_soap_fault 下。尝试在 perl INC 路径中的
上执行 grep。The error handler is located under
SOAP::Transport::HTTP::Server::_output_soap_fault
. Try a grep on<faultcode>
in the perl INC paths.