开发者

How to catch exceptions in an action helper?

When I throw an exception(e.g thr开发者_如何学Cow new Zend_Exception('You are not allowed',403);) in Action Helper, ErrorHandler won't catch it. I got Fatal error: Uncaught exception 'Zend_Exception' with message 'You are not allowed' in...

I've also set up throwExceptions = false in frontController.

How to catch exceptions in Action Controller?


The ErrorHandler plugin is not designed for catching errors in plugins or helpers: it is designed to catch errors that occur in the postDispatch() event loop, and thus, is more suitable for catching errors in your MVC.

This is by design. You should probably not throw exceptions from within controller helpers and action helpers and stick to 'manual' error handling instead.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜