diff --git a/src/App/Document.cpp b/src/App/Document.cpp index 4738174956d9..fa8b662c1c9d 100644 --- a/src/App/Document.cpp +++ b/src/App/Document.cpp @@ -3418,6 +3418,7 @@ int Document::_recomputeFeature(DocumentObject* Feat) } catch(Base::AbortException &e){ e.ReportException(); + FC_ERR("Failed to recompute " << Feat->getFullName() << ": " << e.what()); d->addRecomputeLog("User abort",Feat); return -1; } @@ -3428,6 +3429,7 @@ int Document::_recomputeFeature(DocumentObject* Feat) } catch (Base::Exception &e) { e.ReportException(); + FC_ERR("Failed to recompute " << Feat->getFullName() << ": " << e.what()); d->addRecomputeLog(e.what(),Feat); return 1; } @@ -3449,11 +3451,7 @@ int Document::_recomputeFeature(DocumentObject* Feat) }else{ returnCode->Which = Feat; d->addRecomputeLog(returnCode); -#ifdef FC_DEBUG FC_ERR("Failed to recompute " << Feat->getFullName() << ": " << returnCode->Why); -#else - FC_LOG("Failed to recompute " << Feat->getFullName() << ": " << returnCode->Why); -#endif return 1; } return 0; diff --git a/src/App/FeaturePython.cpp b/src/App/FeaturePython.cpp index c8cc778c3b72..66ec237c409b 100644 --- a/src/App/FeaturePython.cpp +++ b/src/App/FeaturePython.cpp @@ -88,11 +88,7 @@ bool FeaturePythonImp::execute() PyErr_Clear(); return false; } - Base::PyException e; // extract the Python error text - e.ReportException(); - std::stringstream str; - str << object->Label.getValue() << ": " << e.what(); - throw Base::RuntimeError(str.str()); + Base::PyException::ThrowException(); // extract the Python error text } return false; @@ -165,7 +161,7 @@ bool FeaturePythonImp::onBeforeChangeLabel(std::string &newLabel) Py::Object ret(Base::pyCall(py_onBeforeChangeLabel.ptr(),args.ptr())); if(!ret.isNone()) { if(!ret.isString()) - throw Base::TypeError("onBeforeChangeLabel expects to return a string"); + throw Py::TypeError("onBeforeChangeLabel expects to return a string"); newLabel = ret.as_string(); return true; } @@ -252,14 +248,14 @@ bool FeaturePythonImp::getSubObject(DocumentObject *&ret, const char *subname, if(!res.isTrue()) return false; if(!res.isSequence()) - throw Base::TypeError("getSubObject expects return type of tuple"); + throw Py::TypeError("getSubObject expects return type of tuple"); Py::Sequence seq(res); if(seq.length() < 2 || (!seq.getItem(0).isNone() && !PyObject_TypeCheck(seq.getItem(0).ptr(),&DocumentObjectPy::Type)) || !PyObject_TypeCheck(seq.getItem(1).ptr(),&Base::MatrixPy::Type)) { - throw Base::TypeError("getSubObject expects return type of (obj,matrix,pyobj)"); + throw Py::TypeError("getSubObject expects return type of (obj,matrix,pyobj)"); } if(_mat) *_mat = *static_cast(seq.getItem(1).ptr())->getMatrixPtr(); @@ -298,12 +294,12 @@ bool FeaturePythonImp::getSubObjects(std::vector &ret, int reason) if(!res.isTrue()) return true; if(!res.isSequence()) - throw Base::TypeError("getSubObjects expects return type of tuple"); + throw Py::TypeError("getSubObjects expects return type of tuple"); Py::Sequence seq(res); for(size_t i=0;i(seq.getItem(1).ptr())->getMatrixPtr();