From 9e3a981d37a5a2bc5e89804046e3bb1b6c8d8ccd Mon Sep 17 00:00:00 2001 From: "Zheng, Lei" Date: Fri, 2 Aug 2019 12:43:03 +0800 Subject: [PATCH] Base: fix duplicated exception message Because the exception can propagate across C++ and Python boundary multiple times, prepending extra information may cause duplication, something like, "FreeCAD exception thrown(FreeCAD exception thrown(..." --- src/Base/PyObjectBase.h | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/src/Base/PyObjectBase.h b/src/Base/PyObjectBase.h index 94cfb7b7d4..131e015dea 100644 --- a/src/Base/PyObjectBase.h +++ b/src/Base/PyObjectBase.h @@ -466,24 +466,13 @@ BaseExport extern PyObject* BaseExceptionFreeCADAbort; { \ e.ReportException(); \ auto pye = e.getPyExceptionType(); \ - if(!pye) { \ + if(!pye) \ pye = Base::BaseExceptionFreeCADError; \ - std::string str; \ - str += "FreeCAD exception thrown ("; \ - str += e.what(); \ - str += ")"; \ - e.setMessage(str); \ - } \ _Py_ErrorObj(R,pye,e.getPyObject()); \ } \ catch(std::exception &e) \ { \ - std::string str; \ - str += "STL exception thrown ("; \ - str += e.what(); \ - str += ")"; \ - Base::Console().Error(str.c_str()); \ - _Py_Error(R,Base::BaseExceptionFreeCADError,str.c_str()); \ + _Py_Error(R,Base::BaseExceptionFreeCADError,e.what()); \ } \ catch(const Py::Exception&) \ { \