Skip to content

Commit 1fba9ee

Browse files
[Sofa.Core.Binding] Remove suprious exception handler in Binding_DataEngine (#202)
* [Sofa.Core.Binding] Remove suprious exception handler in Binding_DataEngine.cpp The current exception handler in the DataEngine binding is misleading as it convert every exceptions into one saying: "The DataEngine requires an update method with no parameter and no return type" which is wrong. It is better to let the original exception propagate. * [SofaPython] Fix Typo
1 parent 8a543d7 commit 1fba9ee

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

Plugin/src/SofaPython3/PythonEnvironment.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,8 @@ void executePython_(const T& emitter, std::function<void()> cb)
270270
std::stringstream tmp;
271271
tmp << "Unable to execute code." << msgendl
272272
<< "Python exception:" << msgendl
273-
<< " " << e.what();
273+
<< " " << e.what()
274+
<< PythonEnvironment::getPythonCallingPointString();
274275
msg_error(emitter) << tmp.str();
275276
}
276277
}

bindings/Sofa/src/SofaPython3/Sofa/Core/Binding_DataEngine.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,11 @@ void DataEngine_Trampoline::doUpdate()
5959
{
6060
PythonEnvironment::executePython(this, [this](){
6161
py::object self = py::cast(this);
62-
if (py::hasattr(self, "update")) {
62+
if (py::hasattr(self, "update"))
63+
{
6364
py::object fct = self.attr("update");
64-
try {
65-
fct();
66-
return;
67-
} catch (std::exception& /*e*/) {
68-
throw py::type_error(this->getName() + ": The DataEngine requires an update method with no parameter and no return type");
69-
}
65+
fct();
66+
return;
7067
}
7168
throw py::type_error(this->getName() + " has no update() method.");
7269
});

0 commit comments

Comments
 (0)