Using reference for exception catching.
authorBjoern Sikora <bjoern.sikora@intra2net.com>
Mon, 17 May 2010 09:03:16 +0000 (11:03 +0200)
committerBjoern Sikora <bjoern.sikora@intra2net.com>
Mon, 17 May 2010 09:03:16 +0000 (11:03 +0200)
src/net_helper.cpp
src/service_gnudip.cpp

index cbfa659..c9138f6 100644 (file)
@@ -53,7 +53,7 @@ int NetHelper::open_connection(const string& hostname, const string& port)
     {
         IPServicePtr->connect(hostname,port);
     }
-    catch ( boost::system::system_error boost_exception )
+    catch ( boost::system::system_error& boost_exception )
     {
         ostringstream out;
         out << "NetHelper::open_connection(): " << boost_exception.what() << " Host: " << hostname << " Port: " << port;
@@ -75,7 +75,7 @@ int NetHelper::send_data(const std::string& data)
     {
         IPServicePtr->write_to_socket(data);
     }
-    catch ( boost::system::system_error boost_exception )
+    catch ( boost::system::system_error& boost_exception )
     {
         ostringstream out;
         out << "NetHelper::send_data(): " << boost_exception.what() << " Data to be send: " << data;
@@ -97,7 +97,7 @@ std::string NetHelper::receive_data()
     {
         received_data = IPServicePtr->read_from_socket();
     }
-    catch ( boost::system::system_error boost_exception )
+    catch ( boost::system::system_error& boost_exception )
     {
         ostringstream out;
         out << "NetHelper::receive_data(): " << boost_exception.what();
@@ -118,7 +118,7 @@ int NetHelper::close_connection()
     {
         IPServicePtr->close();
     }
-    catch ( boost::system::system_error boost_exception )
+    catch ( boost::system::system_error& boost_exception )
     {
         ostringstream out;
         out << "NetHelper::close_connection(): " << boost_exception.what();
index 1e14149..54c9dfa 100644 (file)
@@ -232,7 +232,7 @@ int ServiceGnudip::perform_update(const std::string& ip)
             {
                 pw_md5_hex = Util::compute_md5_digest(get_password());
             }
-            catch ( invalid_argument e )
+            catch ( invalid_argument& e )
             {
                 get_logger()->print_exception_md5_sum(e.what());
                 return -1;
@@ -247,7 +247,7 @@ int ServiceGnudip::perform_update(const std::string& ip)
             {
                 secret = Util::compute_md5_digest(pw_md5_hex);
             }
-            catch ( invalid_argument e )
+            catch ( invalid_argument& e )
             {
                 get_logger()->print_exception_md5_sum(e.what());
                 return -1;