From: hickert Date: Tue, 19 Apr 2011 09:52:41 +0000 (+0000) Subject: Updated error handling X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=7ece5610b46bf7e0834511b1fa4b26207903d62f;p=gosa.git Updated error handling git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20743 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-core/include/class_jsonRPC.inc b/gosa-core/include/class_jsonRPC.inc index 443d23e19..a3a164e83 100644 --- a/gosa-core/include/class_jsonRPC.inc +++ b/gosa-core/include/class_jsonRPC.inc @@ -121,21 +121,22 @@ class jsonRPC { */ public function get_error() { + $error = ""; if($this->lastStats['http_code'] != 200){ $error = $this->getHttpStatusCodeMessage($this->lastStats['http_code']); - if(isset($this->lastResult['error']['error']) && is_array($this->lastResult['error']['error'])){ - $err = $this->lastResult['error']['error']; - $message = call_user_func_array(sprintf,$err); - $error .= $message; - }elseif(isset($this->lastResult['error']['message'])){ - $error .= ": ".$this->lastResult['error']['message']; - } - return($error); - }else{ - return(curl_error($this->curlHandler)); } + if(isset($this->lastResult['error']['error']) && is_array($this->lastResult['error']['error'])){ + $err = $this->lastResult['error']['error']; + $message = call_user_func_array(sprintf,$err); + $error .= $message; + }elseif(isset($this->lastResult['error']['message'])){ + $error .= $this->lastResult['error']['message']; + } + if($error){ + return(trim($error, ": ")); + } + return(curl_error($this->curlHandler)); } - /*! \brief Returns TRUE if the last action was successfull else FALSE. @@ -144,6 +145,7 @@ class jsonRPC { public function success() { return(curl_errno($this->curlHandler) == 0 && + !isset($this->lastResult['error']) && isset($this->lastStats['http_code']) && $this->lastStats['http_code'] == 200); }