PEAR::raiseError() - suggestion

From: Date: Thu, 04 Sep 2003 17:33:31 +0000
Subject: PEAR::raiseError() - suggestion
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-7588@lists.php.net to get a copy of this message
Imagine scenario: - Foo is a subclass of PEAR - Foo_Error is a subclass of PEAR_Error Then I want PEAR::raiseError() to accept some objects (i.e. some parsed XML), and create proper Foo_Error objects, as Foo_Error's constructor knows these parsed objects, and knows where they hold error codes and error messages: $obj = &$parser->parse($xml); if ($obj->foocode == ERR) return $this->raiseError($obj); The problem is, if raiseError() receives ANY object, it assumes the object is already PEAR_Error or its subclass object (PEAR.php): // The error is yet a PEAR error object if (is_object($message)) { $code = $message->getCode(); $userinfo = $message->getUserInfo(); $error_class = $message->getType(); $message = $message->getMessage(); } Shouldn't it be: // The error is yet a PEAR error object if ($this->isError($message)) { ? -- Marcin Rociek www.rociek.com

« previous php.pear.general (#7588) next »