Re: PEAR, PHP5 and Exceptions
| From: | Michael Wallner | Date: | Thu, 17 Jun 2004 11:46:22 +0000 |
| Subject: | Re: PEAR, PHP5 and Exceptions | ||
| References: | 1 2 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-30855@lists.php.net to get a copy of this message | ||
Hi Hans Lellelid, you wrote:
> Michael Wallner wrote:
>
>> Hi,
>>
>> With the assumption in mind that many PEAR devs fear PHP5s Exceptions
>> I wrote a tiny package, which let you handle Exceptions just like
>> PEAR_Errors if you want to. As far as I'm concerened we wouldn't
>> need that at all if we would just use Exceptions for PHP5 packages.
>
>
> Yeah, I'd think not for PHP5, but it's certainly interesting!
Huh?
>
> On a less related note, but I think belonging to this thread topic, 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.
Hm, that would already be done...
PEAR_ExceptionBroker::create('BOOM', -1, PEAR_Exception::DB)
would throw a DB_Exception if the class exists, or did I
misunderstand you? :)
> In addition to the categories, there are some Exception features that
> would be very nice, for example:
>
> - NestableException
Right, very well!
> 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).
Well, we would need a name other than Exception. So?
Thanks,
--
Michael - < mike(@)php.net >
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc