mirror of https://github.com/GNOME/gimp.git
also use gimp_get_pdb_error() here. Easier and safer than looking at the
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. svn path=/trunk/; revision=26604
This commit is contained in:
parent
64f070eb12
commit
52522c3f4e
|
@ -923,30 +923,6 @@ pf_call(PyGimpPDBFunction *self, PyObject *args, PyObject *kwargs)
|
|||
}
|
||||
|
||||
switch(ret[0].data.d_status) {
|
||||
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");
|
||||
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");
|
||||
gimp_destroy_params(ret, nret);
|
||||
return NULL;
|
||||
break;
|
||||
|
||||
case GIMP_PDB_SUCCESS:
|
||||
#if PG_DEBUG > 0
|
||||
g_printerr("success\n");
|
||||
|
@ -960,6 +936,30 @@ pf_call(PyGimpPDBFunction *self, PyObject *args, PyObject *kwargs)
|
|||
}
|
||||
break;
|
||||
|
||||
case GIMP_PDB_EXECUTION_ERROR:
|
||||
#if PG_DEBUG > 0
|
||||
g_printerr("execution error\n");
|
||||
#endif
|
||||
PyErr_SetString(PyExc_RuntimeError, gimp_get_pdb_error());
|
||||
gimp_destroy_params(ret, nret);
|
||||
return NULL;
|
||||
|
||||
case GIMP_PDB_CALLING_ERROR:
|
||||
#if PG_DEBUG > 0
|
||||
g_printerr("calling error\n");
|
||||
#endif
|
||||
PyErr_SetString(PyExc_RuntimeError, gimp_get_pdb_error());
|
||||
gimp_destroy_params(ret, nret);
|
||||
return NULL;
|
||||
|
||||
case GIMP_PDB_CANCEL:
|
||||
#if PG_DEBUG > 0
|
||||
g_printerr("cancel\n");
|
||||
#endif
|
||||
PyErr_SetString(PyExc_RuntimeError, gimp_get_pdb_error());
|
||||
gimp_destroy_params(ret, nret);
|
||||
return NULL;
|
||||
|
||||
default:
|
||||
#if PG_DEBUG > 0
|
||||
g_printerr("unknown - %i (type %i)\n",
|
||||
|
@ -967,7 +967,6 @@ pf_call(PyGimpPDBFunction *self, PyObject *args, PyObject *kwargs)
|
|||
#endif
|
||||
PyErr_SetString(pygimp_error, "unknown return code");
|
||||
return NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
if (PyTuple_Size(t) == 1) {
|
||||
|
|
Loading…
Reference in New Issue