Sketcher: improve exception handling

* if determining the normal raises an exception then fall back to a default value
* when handling a Base::Exception then call its ReportException() function to get as much information as possible
This commit is contained in:
wmayer
2022-01-08 13:48:01 +01:00
parent 38cc6f29e0
commit 118b7aa0cc

View File

@@ -171,8 +171,13 @@ Restart:
auto curve = dynamic_cast<const Part::GeomCurve *>(geom);
Base::Vector3d normal;
if(!(curve && curve->normalAt(pointoncurve, normal))) {
try {
if(!(curve && curve->normalAt(pointoncurve, normal))) {
normal = Base::Vector3d(1,0,0);
}
}
catch (const Base::CADKernelError&) {
normal = Base::Vector3d(1,0,0);
}
return normal;
@@ -1177,6 +1182,7 @@ Restart:
} catch (Base::Exception &e) {
Base::Console().Error("Exception during draw: %s\n", e.what());
e.ReportException();
} catch (...){
Base::Console().Error("Exception during draw: unknown\n");
}