September 8th, 2010
In Technology
No Comments
If you enjoy this article, see the other most popular articles
If you enjoy this article, see the other most popular articles
If you enjoy this article, see the other most popular articles
Exception handling in the Zend framework
(written by lawrence krubner, however indented passages are often quotes). You can contact lawrence at: lawrence@krubner.com, or follow me on Twitter.
Matthew Weier O’Phinney on handling exceptions in the Zend framework:
Zend Framework exceptions use the following pattern:
A top-level Zend_Exception class is defined, extending Exception, and providing forward compatibility with PHP 5.3 exception support (namely, the “additional exception” argument).
Each component defines a component-level exception extending Zend_Exception, named after the component: e.g., Zend_Application_Exception.
Subcomponents may optionally define additional exceptions, extending from their component exception class.
Only one exception per level in the hierarchy is supported.
This approach, while pragmatic, introduces some inflexibility:
No component may be distributed without Zend_Exception; this becomes a hard dependency.
In many cases, it would make sense to utilize and/or extend one of the various SPL exception classes.
However, due to the requirement that all exceptions derive from Zend_Exception, this is currently impossible.
Currently, developers must rely on exception messages to understand why and/or where an exception was thrown. This has led to several requests for translatable exceptions and/or development of unique exception codes – all of which lead to increased maintenance costs.
Post external references
- 1
http://framework.zend.com/wiki/display/ZFDEV2/Proposal+for+Exceptions+in+ZF2?showComments=false
February 8, 2022 9:33 am
From Michael S on How I recovered from Lyme Disease: I fasted for two weeks, no food, just water
"Did you have Bartonella, too? Seems it uses autogenesis..."