gimp r26604 - trunk/plug-ins/pygimp



Author: neo
Date: Sat Aug 16 17:29:31 2008
New Revision: 26604
URL: http://svn.gnome.org/viewvc/gimp?rev=26604&view=rev

Log:
2008-08-16  Sven Neumann  <sven gimp org>

	* plug-ins/pygimp/pygimp-pdb.c (pf_call): also use
	gimp_get_pdb_error() here. Easier and safer than looking at the
	return values to get the error message.



Modified:
   trunk/plug-ins/pygimp/pygimp-pdb.c

Modified: trunk/plug-ins/pygimp/pygimp-pdb.c
==============================================================================
--- trunk/plug-ins/pygimp/pygimp-pdb.c	(original)
+++ trunk/plug-ins/pygimp/pygimp-pdb.c	Sat Aug 16 17:29:31 2008
@@ -923,42 +923,42 @@
     }
 
     switch(ret[0].data.d_status) {
+    case GIMP_PDB_SUCCESS:
+#if PG_DEBUG > 0
+	g_printerr("success\n");
+#endif
+	t = pygimp_param_to_tuple(nret-1, ret+1);
+	gimp_destroy_params(ret, nret);
+
+	if (t == NULL) {
+	    PyErr_SetString(pygimp_error, "could not make return value");
+	    return NULL;
+	}
+	break;
+
     case GIMP_PDB_EXECUTION_ERROR:
 #if PG_DEBUG > 0
 	g_printerr("execution error\n");
 #endif
-        if (nret > 1 && ret[1].type == GIMP_PDB_STRING)
-          PyErr_SetString(PyExc_RuntimeError, ret[1].data.d_string);
-        else
-          PyErr_SetString(PyExc_RuntimeError, "execution error");
+        PyErr_SetString(PyExc_RuntimeError, gimp_get_pdb_error());
 	gimp_destroy_params(ret, nret);
 	return NULL;
-	break;
 
     case GIMP_PDB_CALLING_ERROR:
 #if PG_DEBUG > 0
 	g_printerr("calling error\n");
 #endif
-        if (nret > 1 && ret[1].type == GIMP_PDB_STRING)
-          PyErr_SetString(PyExc_RuntimeError, ret[1].data.d_string);
-        else
-          PyErr_SetString(PyExc_RuntimeError, "calling error");
+        PyErr_SetString(PyExc_RuntimeError, gimp_get_pdb_error());
 	gimp_destroy_params(ret, nret);
 	return NULL;
-	break;
 
-    case GIMP_PDB_SUCCESS:
+    case GIMP_PDB_CANCEL:
 #if PG_DEBUG > 0
-	g_printerr("success\n");
+	g_printerr("cancel\n");
 #endif
-	t = pygimp_param_to_tuple(nret-1, ret+1);
+        PyErr_SetString(PyExc_RuntimeError, gimp_get_pdb_error());
 	gimp_destroy_params(ret, nret);
-
-	if (t == NULL) {
-	    PyErr_SetString(pygimp_error, "could not make return value");
-	    return NULL;
-	}
-	break;
+	return NULL;
 
     default:
 #if PG_DEBUG > 0
@@ -967,7 +967,6 @@
 #endif
 	PyErr_SetString(pygimp_error, "unknown return code");
 	return NULL;
-	break;
     }
 
     if (PyTuple_Size(t) == 1) {



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