News Feed
Jobs Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Rob Allen's Blog:
Handling exceptions in a Front Controller plugin
December 20, 2010 @ 11:52:48

Rob Allen has another Zend Framework-themed post to his blog today looking at handling exceptions in front controllers a bit more correctly than they're currently treated.

If you have a Zend Framework Front Controller plugin which throws an exception, then the action is still executed and then the error action is then called, so that the displayed output shows two actions rendered, with two layouts also rendered. This is almost certainly not what you want or what you expected.

He points out the more correct process it should follow - dispatch the request and catch the error there before the request continues. The error is then tossed to the error controller for correct handling. He includes the code to do just that, showing how to wrap the routing in a try/catch and push the exception over to the error controller with an "error_handler" plugin created with an exception type of "other".

0 comments voice your opinion now!
exception frontcontroller zendframework errorhandler trycatch


blog comments powered by Disqus

Similar Posts

Zend Developer Zone: php|architect Announces 'Programming with the Zend Framework'

Zend Developer Zone: Zend Framework 1.0.4 Stable and 1.5RC1 Released

ProDevTips.com: Ajax, ZF and Smarty feed reader (Part 2)

Jan Lehnardt's Blog: Using the Zend Framework with Code Igniter (an alternative)

Matthew Weier O'Phinney's Blog: Introducing the ZF2 Plugin Broker


Community Events











Don't see your event here?
Let us know!


hhvm symfony2 performance hack composer security install package language facebook application code podcast unittest opinion component framework introduction release series

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework