From: Tomas V.V.Cox Date: Sun, 26 May 2002 19:08:21 +0000 (+0000) Subject: Make the error handling work again since the new internal command X-Git-Tag: NEW_UI_API_BP~42 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8cd936095b3aa5870ee5de4e8d9ecd6623c1ca34;p=php Make the error handling work again since the new internal command structure --- diff --git a/pear/PEAR/Command/Config.php b/pear/PEAR/Command/Config.php index f2d12b550d..e4441bb970 100644 --- a/pear/PEAR/Command/Config.php +++ b/pear/PEAR/Command/Config.php @@ -83,8 +83,7 @@ in. The default layer is "user". { // $params[0] -> the layer if ($error = $this->_checkLayer(@$params[0])) { - $failmsg .= $error; - break; + return $this->raiseError($error); } $keys = $this->config->getKeys(); sort($keys); @@ -115,11 +114,10 @@ in. The default layer is "user". // $params[0] -> the parameter // $params[1] -> the layer if ($error = $this->_checkLayer(@$params[1])) { - $failmsg .= $error; - break; + return $this->raiseError($error); } if (sizeof($params) < 1 || sizeof($params) > 2) { - $failmsg .= "config-get expects 1 or 2 parameters"; + return $this->raiseError("config-get expects 1 or 2 parameters"); } elseif (sizeof($params) == 1) { $this->ui->displayLine("$params[0] = " . $this->config->get($params[0])); } else { @@ -135,20 +133,22 @@ in. The default layer is "user". // $param[1] -> the value for the parameter // $param[2] -> the layer $failmsg = ''; - if (sizeof($params) < 2 || sizeof($params) > 3) { - $failmsg .= "config-set expects 2 or 3 parameters"; - break; - } - if ($error = $this->_checkLayer(@$params[2])) { - $failmsg .= $error; - break; - } - if (!call_user_func_array(array(&$this->config, 'set'), $params)) - { - $failmsg = "config-set (" . implode(", ", $params) . ") failed"; - } else { - $this->config->store(); - } + do { + if (sizeof($params) < 2 || sizeof($params) > 3) { + $failmsg .= "config-set expects 2 or 3 parameters"; + break; + } + if ($error = $this->_checkLayer(@$params[2])) { + $failmsg .= $error; + break; + } + if (!call_user_func_array(array(&$this->config, 'set'), $params)) + { + $failmsg = "config-set (" . implode(", ", $params) . ") failed"; + } else { + $this->config->store(); + } + } while (false); if ($failmsg) { return $this->raiseError($failmsg); }