cvs: php4 /pear PEAR.php
| From: | Thomas V.V.Cox | Date: | Sun, 29 Jul 2001 04:25:34 +0000 |
| Subject: | cvs: php4 /pear PEAR.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-369@lists.php.net to get a copy of this message | ||
cox Sun Jul 29 00:25:34 2001 EDT
Modified files:
/php4/pear PEAR.php
Log:
raiseError() now can accepts a PEAR error object in its first argument. With
this, users can "re-throw" a previously created PEAR error object (very
useful after the use of (push|pop)ErrorHandling)
Index: php4/pear/PEAR.php
diff -u php4/pear/PEAR.php:1.8 php4/pear/PEAR.php:1.9
--- php4/pear/PEAR.php:1.8 Sat Jul 28 23:46:55 2001
+++ php4/pear/PEAR.php Sun Jul 29 00:25:33 2001
@@ -17,7 +17,7 @@
// | Stig Bakken <ssb@fast.no> |
// +----------------------------------------------------------------------+
//
-// $Id: PEAR.php,v 1.8 2001/07/29 03:46:55 cox Exp $
+// $Id: PEAR.php,v 1.9 2001/07/29 04:25:33 cox Exp $
//
define('PEAR_ERROR_RETURN', 1);
@@ -224,7 +224,7 @@
* handling applied. If the $mode and $options parameters are not
* specified, the object's defaults are used.
*
- * @param $message a text error message
+ * @param $message a text error message or a PEAR error object
* @param $code a numeric error code (it is up to your class
* to define these if you want to use codes)
* @param $mode One of PEAR_ERROR_RETURN, PEAR_ERROR_PRINT,
@@ -260,6 +260,14 @@
$error_class = null,
$skipmsg = false)
{
+ // 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();
+ }
+
if ($mode === null) {
if (isset($this) && isset($this->_default_error_mode)) {
$mode = $this->_default_error_mode;
@@ -453,7 +461,7 @@
$this->message = $message;
$this->code = $code;
$this->mode = $mode;
- $this->userinfo = $userinfo;
+ $this->userinfo = $userinfo;
if ($mode & PEAR_ERROR_CALLBACK) {
$this->level = E_USER_NOTICE;
$this->callback = $options;