From 707f044cb655da4b6cb5223fdc88733b1accd3ce Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 7 Oct 2010 06:08:46 +0000 Subject: [PATCH] Added extended error messages git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19927 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-core/include/class_jsonRPC.inc | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/gosa-core/include/class_jsonRPC.inc b/gosa-core/include/class_jsonRPC.inc index 12bb2af72..d1287d1d8 100644 --- a/gosa-core/include/class_jsonRPC.inc +++ b/gosa-core/include/class_jsonRPC.inc @@ -7,6 +7,7 @@ class jsonRPC { private $config; private $id; private $lastStats = array(); + private $lastResult = array(); private $lastAction = "none"; @@ -89,12 +90,17 @@ class jsonRPC { public function get_error() { if($this->lastStats['http_code'] != 200){ - return($this->getHttpStatusCodeMessage($this->lastStats['http_code'])); + $error = $this->getHttpStatusCodeMessage($this->lastStats['http_code']); + if(isset($this->lastResult['error']['message'])){ + $error .= ": ".$this->lastResult['error']['message']; + } + return($error); }else{ return(curl_error($this->curlHandler)); } } + /*! \brief Returns TRUE if the last action was successfull else FALSE. * @return boolean TRUE on success else FALSE. @@ -139,7 +145,9 @@ class jsonRPC { }else{ DEBUG (DEBUG_RPC, __LINE__, __FUNCTION__, __FILE__,bold($this->get_error())."
".$response, "Result (FAILED): "); } - if(isset($response['error']) && !empty($response['error'])) print_a(array($response)); + if(isset($response['error']) && !empty($response['error'])){ + print_a(array($response)); + } return($response['result']); } @@ -177,6 +185,7 @@ class jsonRPC { // Set current result stats. $this->lastStats = curl_getinfo($this->curlHandler); + $this->lastResult = $response; return($response); } -- 2.30.2