Re: PEAR_Exception in CVS
| From: | Hans Lellelid | Date: | Sun, 20 Jun 2004 19:54:06 +0000 |
| Subject: | Re: PEAR_Exception in CVS | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-30975@lists.php.net to get a copy of this message | ||
Hi Tomas,
Tomas V.V.Cox wrote:
Seconds ago commited the PEAR_Exception base class, done in collaboration with Hans (follow the thread "PEAR.php to PHP5" for more info):Excellent! -- I'll throw PEAR_Exception in Net_GeoIP (and in other classes too; I like the added flexibility). Thanks for being open to incorporating suggestions! I haven't tried it yet, but had one comment from initial look:
public function getCauseMessage($obj) {
$msg = ' ' . $obj->method . " at {$obj->file} ({$obj->line})\n"; if ($obj->cause instanceof Exception) {
return $msg.$obj->getCauseMessage($obj->cause);
}
return $msg;
}
There's a problem here (I believe) with accessing these properties if $obj != $this (as they are not public). I think I do understand why you are doing it this way, however ... Would this work just as well like:
public function getCauseMessage()
{
$msg = ' ' . $this->method . " at {$this->file} ({$this->line})\n";
if ($this->cause instanceof Exception) {
return $msg . $this->cause->getCauseMessage();} return $msg; } It's making my head spin a little, but that should still handle the recursion .... right? Hans