More explicit error message in EtesianEngine.setBlock() Python wrapper.
This commit is contained in:
parent
51c6b90160
commit
0a5fbd9ff0
|
@ -48,10 +48,12 @@ namespace Etesian {
|
||||||
using Isobar::getPyHash;
|
using Isobar::getPyHash;
|
||||||
using Isobar::ParseOneArg;
|
using Isobar::ParseOneArg;
|
||||||
using Isobar::ParseTwoArg;
|
using Isobar::ParseTwoArg;
|
||||||
|
using Isobar::EntityCast;
|
||||||
using Isobar::PyCell;
|
using Isobar::PyCell;
|
||||||
using Isobar::PyCell_Link;
|
using Isobar::PyCell_Link;
|
||||||
using Isobar::PyInstance;
|
using Isobar::PyInstance;
|
||||||
using Isobar::PyInstance_Link;
|
using Isobar::PyInstance_Link;
|
||||||
|
using Isobar::PyTypeInstance;
|
||||||
using Isobar::PyCellViewer;
|
using Isobar::PyCellViewer;
|
||||||
using Isobar::PyTypeCellViewer;
|
using Isobar::PyTypeCellViewer;
|
||||||
using CRL::PyToolEngine;
|
using CRL::PyToolEngine;
|
||||||
|
@ -165,12 +167,15 @@ extern "C" {
|
||||||
cdebug_log(34,0) << "PyEtesianEngine_setBlock()" << endl;
|
cdebug_log(34,0) << "PyEtesianEngine_setBlock()" << endl;
|
||||||
HTRY
|
HTRY
|
||||||
METHOD_HEAD ( "EtesianEngine.setBlock()" )
|
METHOD_HEAD ( "EtesianEngine.setBlock()" )
|
||||||
|
|
||||||
PyInstance* pyInstance = NULL;
|
PyInstance* pyInstance = NULL;
|
||||||
if (not ParseOneArg("EtesianEngine.setBlock",args,INST_ARG,(PyObject**)&pyInstance) )
|
if (not ParseOneArg("EtesianEngine.setBlock",args,INST_ARG,(PyObject**)&pyInstance) )
|
||||||
return NULL;
|
return NULL;
|
||||||
|
Instance* instance = dynamic_cast<Instance*>( EntityCast((PyObject*)pyInstance) );
|
||||||
etesian->setBlock( PYINSTANCE_O(pyInstance) );
|
if (not instance) {
|
||||||
|
PyErr_SetString( ConstructorError, "EtesianEngine.setBlock(): Parameter is not an Instance." );
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
etesian->setBlock( instance );
|
||||||
HCATCH
|
HCATCH
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue