[Libvirt-cim] [PATCH] [CU] #2 Add more meaningful return messages to EO parsing functions

Kaitlin Rupert kaitlin at linux.vnet.ibm.com
Wed Feb 6 16:27:20 UTC 2008


# HG changeset patch
# User Kaitlin Rupert <karupert at us.ibm.com>
# Date 1202315232 28800
# Node ID 2760beb95b59fde75f3323f2cc699f9a8f52964e
# Parent  1e5195053c3280f2185b98da10c595835eee6233
[CU] #2 Add more meaningful return messages to EO parsing functions.

Updates from patch 1 to patch 2:
    -Return CMPI_RC_ERR_INVALID_PARAMETER instead of CMPI_RC_ERR_FAILED in the case of an invalid param.

Add error messages so that something more descriptive than the generic error message is used.

Signed-off-by: Kaitlin Rupert <karupert at us.ibm.com>

diff -r 1e5195053c32 -r 2760beb95b59 std_invokemethod.c
--- a/std_invokemethod.c	Tue Jan 29 11:43:44 2008 -0800
+++ b/std_invokemethod.c	Wed Feb 06 08:27:12 2008 -0800
@@ -55,8 +55,9 @@ static int parse_eo_inst_arg(CMPIString 
         str = CMGetCharPtr(string_in);
 
         if (str == NULL) {
-                CMSetStatus(s, CMPI_RC_ERR_INVALID_PARAMETER);
-                CU_DEBUG("Method parameter value is NULL");
+                cu_statusf(broker, s,
+                           CMPI_RC_ERR_INVALID_PARAMETER,
+                           "Method parameter value is NULL");
                 return 0;
         }
 
@@ -67,8 +68,9 @@ static int parse_eo_inst_arg(CMPIString 
 
         /* cu_parse_embedded_instance() returns 0 on success */
         if ((ret != 0) || CMIsNullObject(instance_out)) {
-                CMSetStatus(s, CMPI_RC_ERR_FAILED);
-                CU_DEBUG("Unable to parse embedded object");
+                cu_statusf(broker, s,
+                           CMPI_RC_ERR_FAILED,
+                           "Unable to parse embedded object");
                 return 0;
         }
 
@@ -86,8 +88,9 @@ static int parse_eo_array(CMPIArray *str
         int count;
 
         if (CMIsNullObject(strings_in)) {
-                CMSetStatus(s, CMPI_RC_ERR_INVALID_PARAMETER);
-                CU_DEBUG("Method parameter is NULL");
+                cu_statusf(broker, s,
+                           CMPI_RC_ERR_INVALID_PARAMETER,
+                           "Method parameter is NULL");
                 return 0;
         }
 
@@ -146,10 +149,11 @@ static int parse_eo_param(CMPIArgs *args
                                      broker,
                                      ns,
                                      s);
-        } else {
-                CMSetStatus(s, CMPI_RC_ERR_FAILED);
-                CU_DEBUG("Unable to parse argument type %d", type);
-        }
+        } else
+                cu_statusf(broker, s,
+                           CMPI_RC_ERR_FAILED,
+                           "Unable to parse argument type %d",
+                           type);
 
         if (ret != 1)
                 return 0;




More information about the Libvirt-cim mailing list