diff --git a/src/App/FeatureTest.cpp b/src/App/FeatureTest.cpp index 6827aaeee4..a24f6046f8 100644 --- a/src/App/FeatureTest.cpp +++ b/src/App/FeatureTest.cpp @@ -23,6 +23,7 @@ #include "PreCompiled.h" #ifndef _PreComp_ +# include #endif @@ -164,7 +165,7 @@ doc.recompute() switch(ExceptionType.getValue()) { case 0: break; - case 1: throw "Test Exception"; + case 1: throw std::runtime_error("Test Exception"); case 2: throw Base::RuntimeError("FeatureTestException::execute(): Testexception"); #if 0 // only allow these error types on purpose case 3: *i=0;printf("%i",*i);break; // seg-fault diff --git a/src/Base/MemDebug.cpp b/src/Base/MemDebug.cpp index 993d9d2080..5341d22f83 100644 --- a/src/Base/MemDebug.cpp +++ b/src/Base/MemDebug.cpp @@ -122,17 +122,17 @@ MemDebug::MemDebug() // Open a log file for the hook functions to use if ( logFile != NULL ) - throw "Base::MemDebug::MemDebug():38: Don't call the constructor by your self!"; + throw std::runtime_error("Base::MemDebug::MemDebug():38: Don't call the constructor by your self!"); #if (_MSC_VER >= 1400) fopen_s( &logFile, "MemLog.txt", "w" ); if ( logFile == NULL ) - throw "Base::MemDebug::MemDebug():41: File IO Error. Can't open log file..."; + throw std::runtime_error("Base::MemDebug::MemDebug():41: File IO Error. Can't open log file..."); _strtime_s( timeStr, 15 ); _strdate_s( dateStr, 15 ); #elif (_MSC_VER >= 1200) logFile = fopen( "MemLog.txt", "w" ); if ( logFile == NULL ) - throw "Base::MemDebug::MemDebug():41: File IO Error. Can't open log file..."; + throw std::runtime_error("Base::MemDebug::MemDebug():41: File IO Error. Can't open log file..."); _strtime( timeStr ); _strdate( dateStr ); #endif diff --git a/src/Mod/MeshPart/App/MeshAlgos.cpp b/src/Mod/MeshPart/App/MeshAlgos.cpp index c52ef1c068..f7d0b19044 100644 --- a/src/Mod/MeshPart/App/MeshAlgos.cpp +++ b/src/Mod/MeshPart/App/MeshAlgos.cpp @@ -191,12 +191,12 @@ MeshCore::MeshKernel* MeshAlgos::boolean(MeshCore::MeshKernel* pMesh1, if (!gts_surface_is_orientable (s1)) { gts_object_destroy (GTS_OBJECT (s1)); gts_object_destroy (GTS_OBJECT (s2)); - throw "surface 1 is not an orientable manifold\n"; + throw std::runtime_error("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 "surface 2 is not an orientable manifold\n"; + throw std::runtime_error("surface 2 is not an orientable manifold\n"); } /* check that the surfaces are not self-intersecting */ @@ -211,7 +211,7 @@ MeshCore::MeshKernel* MeshAlgos::boolean(MeshCore::MeshKernel* pMesh1, gts_object_destroy (GTS_OBJECT (self_intersects)); gts_object_destroy (GTS_OBJECT (s1)); gts_object_destroy (GTS_OBJECT (s2)); - throw "surface is self-intersecting\n"; + throw std::runtime_error("surface is self-intersecting\n"); } self_intersects = gts_surface_is_self_intersecting (s2); if (self_intersects != NULL) { @@ -221,7 +221,7 @@ MeshCore::MeshKernel* MeshAlgos::boolean(MeshCore::MeshKernel* pMesh1, gts_object_destroy (GTS_OBJECT (self_intersects)); gts_object_destroy (GTS_OBJECT (s1)); gts_object_destroy (GTS_OBJECT (s2)); - throw "surface is self-intersecting\n"; + throw std::runtime_error("surface is self-intersecting\n"); } } @@ -285,7 +285,7 @@ MeshCore::MeshKernel* MeshAlgos::boolean(MeshCore::MeshKernel* pMesh1, gts_object_destroy (GTS_OBJECT (si)); gts_bb_tree_destroy (tree1, true); gts_bb_tree_destroy (tree2, true); - throw "the resulting surface is self-intersecting\n"; + throw std::runtime_error("the resulting surface is self-intersecting\n"); } } // display summary information about the resulting surface diff --git a/src/Mod/Path/libarea/clipper.cpp b/src/Mod/Path/libarea/clipper.cpp index 5a0931a049..e1277f0583 100644 --- a/src/Mod/Path/libarea/clipper.cpp +++ b/src/Mod/Path/libarea/clipper.cpp @@ -891,7 +891,7 @@ void RangeTest(const IntPoint& Pt, bool& useFullRange) if (useFullRange) { if (Pt.X > hiRange || Pt.Y > hiRange || -Pt.X > hiRange || -Pt.Y > hiRange) - throw "Coordinate outside allowed range"; + throw std::range_error("Coordinate outside allowed range"); } else if (Pt.X > loRange|| Pt.Y > loRange || -Pt.X > loRange || -Pt.Y > loRange) {