News Feed
Sections




News Archive
feed this:

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


Timothy Boronczyk's Blog:
Goto and Exceptions
March 24, 2009 @ 12:57:12

Timothy Boronczyk has written up a nice post about two practical uses of the "goto" syntax in the upcoming PHP 5.3 release of the popular web scripting language.

Yet goto can still be useful under certain circumstances. For example, some programmers use goto to direct the execution flow to dedicated error-handling logic elsewhere in a program in languages that lack exception handling (such as C).

His two examples are to: emulate exception handling in a procedural environment and to overcome perceived limitations with try/catch. He adds in some code comparing the "without goto" and "with goto" versions of the same code showing how the exception handling might be handled differently.

0 comments voice your opinion now!
goto exception oop example trycatch


PHPBuilder:
A Primer On Postgres Exception Handling For The PHP Developer
November 07, 2007 @ 06:01:00

On PHPBuilder, Robert Bernier has started writing a series of articles on Postgres exception handling. In this one, covers the basics of exception handling for PHP developers.
Postgres exceptions are quite different from PHP exceptions; whereas PHP 5 uses the traditional "Try And Catch" format, Postgres exceptions can only be defined, executed and processed inside the body of the function that triggered the exception.
Also in the article he covers RAISE statements, how Postgres handles them, and gives good practices on how to use them effectively as a method of troubleshooting errors.
0 comments voice your opinion now!
postgres exception handling trycatch raise postgres exception handling trycatch raise



Community Events





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


install release list framework refactor wordpress configure testing opinion threedevsandamaybe developer code laravel interview introduction unittest community podcast series language

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