Re: My Experience with PHP5 Error Handling (and possible
| From: | Sergio Carvalho | Date: | Thu, 26 Aug 2004 14:43:48 +0000 |
| Subject: | Re: My Experience with PHP5 Error Handling (and possible | ||
| References: | 1 2 3 4 5 6 7 8 9 10 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-32961@lists.php.net to get a copy of this message | ||
Davey wrote:
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc
eeeeeeeeeew. Sorry, thats ugly, its a waste of resources to instantiate so many classes and extending Exception everytime which gives you the getCode()... no, bad idea, sorry. Stick to using exceptions as they should be, the name for the package, and $exception->getCode() for the error code (which can then be used to get messages or whatever you want to associate with it. Think of it as a primary key from which you can get all the other error details - this is what PEAR_Exception has to decide on - what information we put into the exception)No, Greg described exactly how Exceptions should be used. Unless you come up with hard numbers proving that defining classes to /classify/ errors introduces severe overhead, your opinion falls on the group of early optimization errors. Exception class hierarchies are way richer and descriptive than error code flat categorization. Cheers, Sérgio Carvalho
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc