Re: PHP5: PEAR base Exception classes

From: Date: Tue, 22 Jun 2004 01:54:02 +0000
Subject: Re: PHP5: PEAR base Exception classes
References: 1 2 3 4 5 6 7 8  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-31073@lists.php.net to get a copy of this message
Quoting Hans Lellelid <hans@velum.net>:
I would say that the main benefit of the PEAR_Exception class is that it provides support for observers which can handle logging (or even immediate death). It also provides support for nesting exceptions, which is useful. I think the value of PEAR_Exception is in these features & not in the "namespace" that it provides.
That makes sense to me, as long as PEAR_Exception is an optional component available to those who need those features. It doesn't make sense to me to require it for all PEAR packages, though.
I'm curious to know what your take on Exception-based error handling is, Chuck. From the parts of Horde I've seen, it seems like you're in a perfect position to comment on PEAR's use of Exception in the long run, given the extent to which Horde makes use of PEAR libraries in a many-layered framework. My impression was that it would be a big benefit to the Horde framework.
It could definitely simplify a lot of things, especially a lot of the ... $result = do_something(); if (is_a($result, 'PEAR_Error')) {
    return $result;
} ... code that we have around to bubble errors properly. ErrorStack would give ua a number of the same kinds of things, with perhaps even a little more flexibility. I'm not sure what insights I can give you, though. :) It'll definitely be something that we look at when we leave PHP4 behind, though. -chuck -- "Regard my poor demoralized mule!" - Juan Valdez

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