How to catch exceptions in action helper?

When I throw new Zend_Exception('You are not allowed',403); exception (e.g. throw new Zend_Exception('You are not allowed',403); ) in the Action Helper, the ErrorHandler will not catch it. I got Fatal error: Uncaught exception 'Zend_Exception' with message 'You are not allowed' in..

I also set throwExceptions = false in frontController.

How to catch exceptions in Action Controller?

+4
source share
1 answer

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

This is by design. You should probably not exclude exceptions from the controller assistants and action assistants, and use β€œmanual” error handling instead.

+3
source

All Articles