PHP5: PEAR base Exception classes

From: Date: Thu, 17 Jun 2004 13:14:56 +0000
Subject: PHP5: PEAR base Exception classes
Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-30861@lists.php.net to get a copy of this message
[Re-post as new thread since this wasn't really a response to Michael's suggestion of using Exceptions like PEAR_Error.] I think it would be great if PEAR provided some re-usable base Exception classes. Would there be an 'exceptions' package? I don't see any need to prefix these w/ a category name, though, since they'd be generic: I'm thinking in particular of having a few different extension categories that PHP5 packages *may* use if desired, e.g.:
    - IOException
    - MathException
    - ... (I'm sure there are many others)
I don't think that every package needs its own Extensions, but in some cases a given package will want to be able to selectively throw different categories for handling by the calling code. Exceptions become useful when you can use hierarchies & selectively catch. Again, classes could always throw the base Exception object if desired. In addition to the categories, there are some Exception features that would be very nice, for example:
    - NestableException
This is an Exception that allows you to wrap an existing Exception and re-throw it without losing any info from the original. This would be particularly useful for PEAR & should be a base class for the other Exception types IMO. How does one propose code that goes into core PEAR? I imagine that this would be in something like an 'exception/' dir, but, again, I don't see any reason to add a prefix as that would be completely redundant (and make using them just more cumbersome). Hans

« previous php.pear.dev (#30861) next »