From fb841d64c85b570ed488032ca184c8aed4c423ef Mon Sep 17 00:00:00 2001 From: wmayer Date: Sat, 15 Jul 2017 17:16:44 +0200 Subject: [PATCH] handle OCC exception in Feature::getPySubObjects and convert to Python exception --- src/Mod/Part/App/PartFeature.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/Mod/Part/App/PartFeature.cpp b/src/Mod/Part/App/PartFeature.cpp index c1fc03c048..b98214131c 100644 --- a/src/Mod/Part/App/PartFeature.cpp +++ b/src/Mod/Part/App/PartFeature.cpp @@ -107,13 +107,19 @@ PyObject *Feature::getPyObject(void) std::vector Feature::getPySubObjects(const std::vector& NameVec) const { - std::vector temp; - for(std::vector::const_iterator it=NameVec.begin();it!=NameVec.end();++it){ - PyObject *obj = Shape.getShape().getPySubShape((*it).c_str()); - if(obj) - temp.push_back(obj); + try { + std::vector temp; + for(std::vector::const_iterator it=NameVec.begin();it!=NameVec.end();++it){ + PyObject *obj = Shape.getShape().getPySubShape((*it).c_str()); + if(obj) + temp.push_back(obj); + } + return temp; + } + catch (Standard_Failure) { + Handle(Standard_Failure) e = Standard_Failure::Caught(); + throw Py::ValueError(e->GetMessageString()); } - return temp; } void Feature::onChanged(const App::Property* prop)