From f34ec4534cdc2fbbe771ce42f8a13be8c62f11ba Mon Sep 17 00:00:00 2001 From: wmayer Date: Wed, 14 Nov 2018 17:11:53 +0100 Subject: [PATCH] Replace Base::Exception with appropriate subclass --- src/Mod/Assembly/Gui/CommandConstraints.cpp | 2 +- src/Mod/Cam/App/AppCamPy.cpp | 2 +- src/Mod/Cam/App/Approx.cpp | 2 +- src/Mod/Cam/App/SpringbackCorrection.cpp | 4 ++-- src/Mod/Cam/App/UniGridApprox.cpp | 2 +- src/Mod/Cam/App/best_fit.cpp | 8 ++++---- src/Mod/Cam/App/path_simulate.cpp | 6 +++--- src/Mod/Mesh/App/GTSAlgos.cpp | 14 +++++++------- 8 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/Mod/Assembly/Gui/CommandConstraints.cpp b/src/Mod/Assembly/Gui/CommandConstraints.cpp index 8f1af13a03..04354f7723 100644 --- a/src/Mod/Assembly/Gui/CommandConstraints.cpp +++ b/src/Mod/Assembly/Gui/CommandConstraints.cpp @@ -89,7 +89,7 @@ bool getConstraintPrerequisits(Assembly::Product** Asm, Assembly::ConstraintGrou *ConstGrp = getConstraintGroup(*Asm); if(!*ConstGrp) - throw Base::Exception("Could not create Assembly::ConstraintGroup in active Assembly"); + throw Base::RuntimeError("Could not create Assembly::ConstraintGroup in active Assembly"); // return with no error return false; diff --git a/src/Mod/Cam/App/AppCamPy.cpp b/src/Mod/Cam/App/AppCamPy.cpp index 1439ac7982..aba2736c86 100644 --- a/src/Mod/Cam/App/AppCamPy.cpp +++ b/src/Mod/Cam/App/AppCamPy.cpp @@ -230,7 +230,7 @@ static PyObject * tesselateShape(PyObject *self, PyObject *args) // if the triangulation of only one face is not possible to get else { - throw Base::Exception("Empty face triangulation\n"); + throw Base::RuntimeError("Empty face triangulation\n"); } } // finish FreeCAD Mesh Builder and exit with new mesh diff --git a/src/Mod/Cam/App/Approx.cpp b/src/Mod/Cam/App/Approx.cpp index ad4ec38d77..f133484700 100644 --- a/src/Mod/Cam/App/Approx.cpp +++ b/src/Mod/Cam/App/Approx.cpp @@ -694,7 +694,7 @@ void Approximate::ParameterInnerPoints() } else //Can an inside point have less than 3 neighbours...? { - throw Base::Exception("Something's wrong here. Less than 3 Neighbour"); + throw Base::RuntimeError("Something's wrong here. Less than 3 Neighbour"); } } } diff --git a/src/Mod/Cam/App/SpringbackCorrection.cpp b/src/Mod/Cam/App/SpringbackCorrection.cpp index dc8cf02993..8248a0a3cf 100644 --- a/src/Mod/Cam/App/SpringbackCorrection.cpp +++ b/src/Mod/Cam/App/SpringbackCorrection.cpp @@ -308,7 +308,7 @@ bool SpringbackCorrection::CalcCurv() if (pnt2edge.IsDone() == false) { - throw Base::Exception("couldn't perform distance calculation pnt2edge \n"); + throw Base::RuntimeError("couldn't perform distance calculation pnt2edge \n"); } dist = pnt2edge.Value(); @@ -730,7 +730,7 @@ bool SpringbackCorrection::TransferFaceTriangulationtoFreeCAD(const TopoDS_Face& // if the triangulation of only one face is not possible to get else { - throw Base::Exception("Empty face triangulation\n"); + throw Base::RuntimeError("Empty face triangulation\n"); } // finish FreeCAD Mesh Builder and exit with new mesh diff --git a/src/Mod/Cam/App/UniGridApprox.cpp b/src/Mod/Cam/App/UniGridApprox.cpp index d58c8c1637..692b71ade8 100644 --- a/src/Mod/Cam/App/UniGridApprox.cpp +++ b/src/Mod/Cam/App/UniGridApprox.cpp @@ -82,7 +82,7 @@ bool UniGridApprox::Perform(double TOL) maxErr = CompMeshError(); if (maxErr == -1) - throw Base::Exception("CompError() couldn't project one point..."); + throw Base::RuntimeError("CompError() couldn't project one point..."); cout << " -> " << maxErr << endl; diff --git a/src/Mod/Cam/App/best_fit.cpp b/src/Mod/Cam/App/best_fit.cpp index e4989d7c47..95bdbeefd6 100644 --- a/src/Mod/Cam/App/best_fit.cpp +++ b/src/Mod/Cam/App/best_fit.cpp @@ -875,7 +875,7 @@ bool best_fit::RotMat(Base::Matrix4D &M, double degree, int axis) M[1][1]=cos(degree); break; default: - throw Base::Exception("second input value differs from 1,2,3 (x,y,z)"); + throw Base::RuntimeError("second input value differs from 1,2,3 (x,y,z)"); } return true; @@ -897,7 +897,7 @@ bool best_fit::TransMat(Base::Matrix4D &M, double trans, int axis) M[2][3] = trans; break; default: - throw Base::Exception("second input value differs from 1,2,3 (x,y,z)"); + throw Base::RuntimeError("second input value differs from 1,2,3 (x,y,z)"); } return true; @@ -1390,7 +1390,7 @@ bool best_fit::Tesselate_Face(const TopoDS_Face &aface, MeshCore::MeshKernel &me // if the triangulation of only one face is not possible to get else { - throw Base::Exception("Empty face triangulation\n"); + throw Base::RuntimeError("Empty face triangulation\n"); } // finish FreeCAD Mesh Builder and exit with new mesh @@ -1484,7 +1484,7 @@ bool best_fit::Tesselate_Shape(const TopoDS_Shape &shape, MeshCore::MeshKernel & // if the triangulation of only one face is not possible to get else { - throw Base::Exception("Empty face triangulation\n"); + throw Base::RuntimeError("Empty face triangulation\n"); } } // finish FreeCAD Mesh Builder and exit with new mesh diff --git a/src/Mod/Cam/App/path_simulate.cpp b/src/Mod/Cam/App/path_simulate.cpp index 5cf0754ec5..3a555267ba 100644 --- a/src/Mod/Cam/App/path_simulate.cpp +++ b/src/Mod/Cam/App/path_simulate.cpp @@ -192,7 +192,7 @@ double path_simulate::GetVelocity(double t) } } else - throw Base::Exception("time input not inside [t0, T]"); + throw Base::RuntimeError("time input not inside [t0, T]"); return vel; } @@ -242,7 +242,7 @@ double path_simulate::GetDistance(double t) } else { - throw Base::Exception("time input not inside [t0,T]"); + throw Base::RuntimeError("time input not inside [t0,T]"); } return d; @@ -3060,7 +3060,7 @@ bool path_simulate::WriteOutputSingle(ofstream &anOutputFile, int &c, bool brob, n = Out_val.size(); if (n != Out_time.size()) - throw Base::Exception("Outputlängen passen nicht zusammen"); + throw Base::RuntimeError("Outputlängen passen nicht zusammen"); if (n>1) { diff --git a/src/Mod/Mesh/App/GTSAlgos.cpp b/src/Mod/Mesh/App/GTSAlgos.cpp index ee46f27260..a915f1f846 100644 --- a/src/Mod/Mesh/App/GTSAlgos.cpp +++ b/src/Mod/Mesh/App/GTSAlgos.cpp @@ -68,7 +68,7 @@ void GTSAlgos::coarsen(float f) } catch (...) { gts_object_destroy (GTS_OBJECT (surface)); - throw Base::Exception("Unknown error in GTSAlgos::coarsen()"); + throw Base::RuntimeError("Unknown error in GTSAlgos::coarsen()"); } // get the standard mesh @@ -99,12 +99,12 @@ void GTSAlgos::boolean(const Mesh::MeshObject& ToolMesh, int Type) if (!gts_surface_is_orientable (s1)) { gts_object_destroy (GTS_OBJECT (s1)); gts_object_destroy (GTS_OBJECT (s2)); - throw Base::Exception("surface 1 is not an orientable manifold\n"); + throw Base::RuntimeError("surface 1 is not an orientable manifold\n"); } if (!gts_surface_is_orientable (s2)) { gts_object_destroy (GTS_OBJECT (s1)); gts_object_destroy (GTS_OBJECT (s2)); - throw Base::Exception("surface 2 is not an orientable manifold\n"); + throw Base::RuntimeError("surface 2 is not an orientable manifold\n"); } // check that the surfaces are not self-intersecting @@ -119,7 +119,7 @@ void GTSAlgos::boolean(const Mesh::MeshObject& ToolMesh, int Type) gts_object_destroy (GTS_OBJECT (self_intersects)); gts_object_destroy (GTS_OBJECT (s1)); gts_object_destroy (GTS_OBJECT (s2)); - throw Base::Exception("surface is self-intersecting\n"); + throw Base::RuntimeError("surface is self-intersecting\n"); } self_intersects = gts_surface_is_self_intersecting (s2); if (self_intersects != NULL) { @@ -129,7 +129,7 @@ void GTSAlgos::boolean(const Mesh::MeshObject& ToolMesh, int Type) gts_object_destroy (GTS_OBJECT (self_intersects)); gts_object_destroy (GTS_OBJECT (s1)); gts_object_destroy (GTS_OBJECT (s2)); - throw Base::Exception("surface is self-intersecting\n"); + throw Base::RuntimeError("surface is self-intersecting\n"); } } @@ -149,7 +149,7 @@ void GTSAlgos::boolean(const Mesh::MeshObject& ToolMesh, int Type) gts_object_destroy (GTS_OBJECT (s2)); gts_bb_tree_destroy (tree1, TRUE); gts_bb_tree_destroy (tree2, TRUE); - throw Base::Exception("the intersection of 1 and 2 is not a closed curve\n"); + throw Base::RuntimeError("the intersection of 1 and 2 is not a closed curve\n"); } s3 = gts_surface_new (gts_surface_class (), @@ -193,7 +193,7 @@ void GTSAlgos::boolean(const Mesh::MeshObject& ToolMesh, int Type) gts_object_destroy (GTS_OBJECT (si)); gts_bb_tree_destroy (tree1, TRUE); gts_bb_tree_destroy (tree2, TRUE); - throw Base::Exception("the resulting surface is self-intersecting\n"); + throw Base::RuntimeError("the resulting surface is self-intersecting\n"); } } // display summary information about the resulting surface