From d327e81653bf86cbfffe449f597a6555cd32b5b2 Mon Sep 17 00:00:00 2001 From: Bjoern Sikora Date: Mon, 17 May 2010 11:03:16 +0200 Subject: [PATCH] Using reference for exception catching. --- src/net_helper.cpp | 8 ++++---- src/service_gnudip.cpp | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/net_helper.cpp b/src/net_helper.cpp index cbfa659..c9138f6 100644 --- a/src/net_helper.cpp +++ b/src/net_helper.cpp @@ -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(); diff --git a/src/service_gnudip.cpp b/src/service_gnudip.cpp index 1e14149..54c9dfa 100644 --- a/src/service_gnudip.cpp +++ b/src/service_gnudip.cpp @@ -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; -- 1.7.1