![](/img/trans.png)
[英]How to catch my own Model Exceptions in a Zend Framework Action
[英]How to catch exceptions in an action helper?
当我在 Action Helper 中抛出异常(例如throw new Zend_Exception('You are not allowed',403);
)时,ErrorHandler 不会捕获它。 我收到Fatal error: Uncaught exception 'Zend_Exception' with message 'You are not allowed' in..
我还在 frontController 中设置了 throwExceptions = false。
如何在动作 Controller 中捕获异常?
ErrorHandler 插件不是为捕获插件或助手中的错误而设计的:它旨在捕获postDispatch()
事件循环中发生的错误,因此更适合于捕获 MVC 中的错误。
这是设计使然。 您可能不应该从 controller 助手和操作助手中抛出异常,而是坚持“手动”错误处理。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.