Code

Added error handling to remote Object
[gosa.git] / gosa-core / include / class_remoteObject.inc
index 224081a4525edcb8f35aa677504b5ae25e7a360f..c3e241f08c667abda62c36a74827d28834b714d5 100644 (file)
@@ -15,6 +15,8 @@ class remoteObject
     private $object_id;
     private $ref_id;
     private $values;
+    private $success;
+    private $lastError;
 
     private $cache = array();
 
@@ -116,6 +118,8 @@ class remoteObject
 
         // Forward to the call to the backend.
         if(in_array($name, $this->methods)){
+            $this->lastError = "";
+            $this->success = TRUE;
             $fArgs = array();
             $fArgs[] = $this->ref_id;
             $fArgs[] = $name;
@@ -123,7 +127,9 @@ class remoteObject
             $res = call_user_func_array(array($this->rpcHandle,"dispatchObjectMethod"), $fArgs);
 
             if(!$this->rpcHandle->success()){
-                trigger_error($this->rpcHandle->get_error());
+                $this->success = FALSE;
+                $this->lastError = $this->rpcHandle->get_error();
+                trigger_error($this->lastError);
             }
 
             return($res);
@@ -134,6 +140,12 @@ class remoteObject
     }
 
 
+    function success()
+    {
+        return($this->success);
+    }
+
+
     /*!\brief   A catch all method for setter calls. 
      *           
      * @param   String  The name of the property to set.