diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2009-03-29 21:44:14 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2009-03-29 21:44:14 +0400 |
commit | 68e088f1cf3e3b8daa4a5d17acb6f0525ca6de95 (patch) | |
tree | a7b25263104f72f16d340119a09fcbcf29f8e695 /source/blender/freestyle/intern/python/Interface0D | |
parent | d79ddebaaec697e1775a6f652a1ee064eb053bf4 (diff) |
Improvements on error handling in the Python API.
Diffstat (limited to 'source/blender/freestyle/intern/python/Interface0D')
-rw-r--r-- | source/blender/freestyle/intern/python/Interface0D/BPy_CurvePoint.cpp | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/source/blender/freestyle/intern/python/Interface0D/BPy_CurvePoint.cpp b/source/blender/freestyle/intern/python/Interface0D/BPy_CurvePoint.cpp index cb2e30f841a..5c739f9cd29 100644 --- a/source/blender/freestyle/intern/python/Interface0D/BPy_CurvePoint.cpp +++ b/source/blender/freestyle/intern/python/Interface0D/BPy_CurvePoint.cpp @@ -143,9 +143,11 @@ int CurvePoint___init__(BPy_CurvePoint *self, PyObject *args, PyObject *kwds) ((BPy_CurvePoint *) obj2)->cp, PyFloat_AsDouble( obj3 ) ); } else { + PyErr_SetString(PyExc_TypeError, "invalid argument(s)"); return -1; } } else { + PyErr_SetString(PyExc_TypeError, "invalid argument(s)"); return -1; } @@ -186,10 +188,8 @@ PyObject * CurvePoint_t2d( BPy_CurvePoint *self ) { PyObject *CurvePoint_setA( BPy_CurvePoint *self , PyObject *args) { PyObject *py_sv; - if(!( PyArg_ParseTuple(args, "O", &py_sv) && BPy_SVertex_Check(py_sv) )) { - cout << "ERROR: CurvePoint_setA" << endl; - Py_RETURN_NONE; - } + if(!( PyArg_ParseTuple(args, "O!", &SVertex_Type, &py_sv) )) + return NULL; self->cp->setA( ((BPy_SVertex *) py_sv)->sv ); @@ -199,10 +199,8 @@ PyObject *CurvePoint_setA( BPy_CurvePoint *self , PyObject *args) { PyObject *CurvePoint_setB( BPy_CurvePoint *self , PyObject *args) { PyObject *py_sv; - if(!( PyArg_ParseTuple(args, "O", &py_sv) && BPy_SVertex_Check(py_sv) )) { - cout << "ERROR: CurvePoint_setB" << endl; - Py_RETURN_NONE; - } + if(!( PyArg_ParseTuple(args, "O!", &SVertex_Type, &py_sv) )) + return NULL; self->cp->setB( ((BPy_SVertex *) py_sv)->sv ); @@ -212,10 +210,8 @@ PyObject *CurvePoint_setB( BPy_CurvePoint *self , PyObject *args) { PyObject *CurvePoint_setT2d( BPy_CurvePoint *self , PyObject *args) { float t; - if( !PyArg_ParseTuple(args, "f", &t) ) { - cout << "ERROR: CurvePoint_setT2d" << endl; - Py_RETURN_NONE; - } + if(!( PyArg_ParseTuple(args, "f", &t) )) + return NULL; self->cp->setT2d( t ); |