[pygobject/invoke-rewrite] [gi-invoke-rewrite] backport glib error handling



commit 3d5d9ff5c18a850650992bdd52e8e4c722b23396
Author: John (J5) Palmieri <johnp redhat com>
Date:   Mon Mar 28 15:01:12 2011 -0400

    [gi-invoke-rewrite] backport glib error handling

 gi/pygi-invoke-ng.c |   14 ++++++--------
 1 files changed, 6 insertions(+), 8 deletions(-)
---
diff --git a/gi/pygi-invoke-ng.c b/gi/pygi-invoke-ng.c
index ec057e9..eb01a30 100644
--- a/gi/pygi-invoke-ng.c
+++ b/gi/pygi-invoke-ng.c
@@ -22,6 +22,7 @@
  * USA
  */
 
+#include <pyglib.h>
 #include "pygi-invoke.h"
 
 
@@ -59,9 +60,7 @@ _invoke_function (PyGIInvokeState *state,
 
     if (!retval) {
         g_assert (error != NULL);
-        /* TODO: raise the right error, out of the error domain. */
-        PyErr_SetString (PyExc_RuntimeError, error->message);
-        g_error_free (error);
+        pyglib_error_check(&error);
 
         /* TODO: release input arguments. */
 
@@ -69,12 +68,11 @@ _invoke_function (PyGIInvokeState *state,
     }
 
     if (state->error != NULL) {
-        /* TODO: raise the right error, out of the error domain, if applicable. */
-        PyErr_SetString (PyExc_Exception, state->error->message);
+        if (pyglib_error_check(&(state->error))) {
+            /* TODO: release input arguments. */
 
-        /* TODO: release input arguments. */
-
-        return FALSE;
+            return FALSE;
+        }
     }
 
     return TRUE;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]