From 1a586e58be0c043e9cc3818312041ed8d4926fc6 Mon Sep 17 00:00:00 2001
From: Mirko Waechter <mirko.waechter@kit.edu>
Date: Sat, 23 Jun 2018 17:31:57 +0200
Subject: [PATCH] made exception catching const and reference

---
 MotionPlanning/examples/MultiThreadedPlanning/MTPlanning.cpp  | 2 +-
 MotionPlanning/examples/RRT/RRTdemo.cpp                       | 4 ++--
 VirtualRobot/Workspace/WorkspaceRepresentation.cpp            | 2 +-
 .../examples/ReachabilityMap/ReachabilityMapWindow.cpp        | 4 ++--
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/MotionPlanning/examples/MultiThreadedPlanning/MTPlanning.cpp b/MotionPlanning/examples/MultiThreadedPlanning/MTPlanning.cpp
index c84be3a87..4450e8e2f 100644
--- a/MotionPlanning/examples/MultiThreadedPlanning/MTPlanning.cpp
+++ b/MotionPlanning/examples/MultiThreadedPlanning/MTPlanning.cpp
@@ -35,7 +35,7 @@ int main(int argc, char** argv)
     {
         startMTPlanning();
     }
-    catch (std::exception e)
+    catch(const std::exception &e)
     {
         std::cout << "Exception: " << e.what() << std::endl ;
     }
diff --git a/MotionPlanning/examples/RRT/RRTdemo.cpp b/MotionPlanning/examples/RRT/RRTdemo.cpp
index 4479a2a60..bbf178cef 100644
--- a/MotionPlanning/examples/RRT/RRTdemo.cpp
+++ b/MotionPlanning/examples/RRT/RRTdemo.cpp
@@ -218,11 +218,11 @@ int main(int /*argc*/, char** /*argv*/)
     {
         startRRTVisualization();
     }
-    catch (VirtualRobot::VirtualRobotException v)
+    catch(const VirtualRobot::VirtualRobotException &v)
     {
         std::cout << "VirtualRobot Exception: " << v.what() << std::endl ;
     }
-    catch (std::exception e)
+    catch(const std::exception &e)
     {
         std::cout << "Exception: " << e.what() << std::endl ;
     }
diff --git a/VirtualRobot/Workspace/WorkspaceRepresentation.cpp b/VirtualRobot/Workspace/WorkspaceRepresentation.cpp
index a0d45f903..86c62da24 100644
--- a/VirtualRobot/Workspace/WorkspaceRepresentation.cpp
+++ b/VirtualRobot/Workspace/WorkspaceRepresentation.cpp
@@ -109,7 +109,7 @@ namespace VirtualRobot
         {
             dest  = new unsigned char[/*2 * */size];
         }
-        catch (std::exception e)
+        catch(const std::exception &e)
         {
             VR_ERROR << "Error:" << e.what() << endl << "Could not assign " << size << " bytes of memory. Reduce size of WorkspaceRepresentation data..." << endl;
             throw;
diff --git a/VirtualRobot/examples/ReachabilityMap/ReachabilityMapWindow.cpp b/VirtualRobot/examples/ReachabilityMap/ReachabilityMapWindow.cpp
index 643b5b745..4c2d65fd0 100644
--- a/VirtualRobot/examples/ReachabilityMap/ReachabilityMapWindow.cpp
+++ b/VirtualRobot/examples/ReachabilityMap/ReachabilityMapWindow.cpp
@@ -701,7 +701,7 @@ void ReachabilityMapWindow::setupEnvironment()
     {
         environment = ObjectIO::loadManipulationObject(objectFile);
     }
-    catch (VirtualRobotException e)
+    catch(const VirtualRobotException &e)
     {
         VR_ERROR << "Could not load " << objectFile << endl;
         return;
@@ -732,7 +732,7 @@ void ReachabilityMapWindow::loadObjectFile(std::string filename)
     {
         graspObject = ObjectIO::loadManipulationObject(filename);
     }
-    catch (VirtualRobotException e)
+    catch(const VirtualRobotException &e)
     {
         VR_ERROR << "Could not load " << filename << endl;
         return;
-- 
GitLab