Skip to content
Snippets Groups Projects
Commit 257c4456 authored by Florent Lamiraux's avatar Florent Lamiraux Committed by Florent Lamiraux florent@laas.fr
Browse files

Return a python error instead of throwing C++ exception.

parent 393a1295
No related branches found
No related tags found
No related merge requests found
...@@ -54,9 +54,16 @@ namespace dynamicgraph { ...@@ -54,9 +54,16 @@ namespace dynamicgraph {
/* Try to find if the corresponding object already exists. */ /* Try to find if the corresponding object already exists. */
if( dynamicgraph::g_pool.existEntity( instanceName,obj ) ) if( dynamicgraph::g_pool.existEntity( instanceName,obj ) )
{ {
if( obj->getClassName()!=className ) if( obj->getClassName()!=className ) {
throw ExceptionPython( ExceptionPython::CLASS_INCONSISTENT, std::string msg ("Found an object named "
"Found an object with the same name but of different class." ); + std::string(instanceName)
+ ",\n""but this object is of type "
+ std::string(obj->getClassName())
+ " and not "
+ std::string(className));
PyErr_SetString(dgpyError, msg.c_str());
return NULL;
}
} }
else /* If not, create a new object. */ else /* If not, create a new object. */
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment