From 0c7e5323e891e5b32b4bfae58115137e805adfeb Mon Sep 17 00:00:00 2001 From: Tamito Kajiyama Date: Fri, 20 Mar 2009 22:41:27 +0000 Subject: Improvements in error handling at Python-C++ boundaries. --- .../UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp') diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp index 3796cf64875..6e3ff1fde4b 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp @@ -160,13 +160,17 @@ PyObject * UnaryFunction0DEdgeNature___call__( BPy_UnaryFunction0DEdgeNature *se { PyObject *obj; - if(!PyArg_ParseTuple(args, "O!", &Interface0DIterator_Type, &obj)) { - cout << "ERROR: UnaryFunction0DEdgeNature___call__ " << endl; + if(!PyArg_ParseTuple(args, "O!", &Interface0DIterator_Type, &obj)) return NULL; - } - Nature::EdgeNature n = self->uf0D_edgenature->operator()(*( ((BPy_Interface0DIterator *) obj)->if0D_it )); - return BPy_Nature_from_Nature( n ); + if (self->uf0D_edgenature->operator()(*( ((BPy_Interface0DIterator *) obj)->if0D_it )) < 0) { + if (!PyErr_Occurred()) { + string msg(self->uf0D_edgenature->getName() + " __call__ method failed"); + PyErr_SetString(PyExc_RuntimeError, msg.c_str()); + } + return NULL; + } + return BPy_Nature_from_Nature( self->uf0D_edgenature->result ); } -- cgit v1.2.3