Should the PHP community start using more descriptive Exceptions?
Posted
by fireeyedboy
on Stack Overflow
See other posts from Stack Overflow
or by fireeyedboy
Published on 2010-04-18T15:46:00Z
Indexed on
2010/04/18
16:33 UTC
Read the original article
Hit count: 282
I work with Zend Framework a lot and I just took a peek at Kohana, and it strikes me as odd that this is a typical scenario in these frameworks:
throw Some_Componenents_Exception( 'invalid argument' );
Where I believe this wouldn't be mouch more useful:
throw Some_Components_InvalidArgumentException( 'whatever discription' );
Because it is easier to catch.
I suspect, but immediately admit it's prejudiced, that the former practice is common in the PHP community. Should we, the PHP community, start using these descriptive types of expections more?
© Stack Overflow or respective owner