From 0092243cbce347876f080eea9305813c137e72c2 Mon Sep 17 00:00:00 2001 From: Denys Haryachyy Date: Thu, 25 Aug 2016 23:07:42 +0300 Subject: [PATCH] Print an exception description once catched. (#60) --- fpmsyncd/fpmsyncd.cpp | 4 ++-- intfsyncd/intfsyncd.cpp | 4 ++-- neighsyncd/neighsyncd.cpp | 4 ++-- portsyncd/portsyncd.cpp | 4 ++-- teamsyncd/teamsyncd.cpp | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/fpmsyncd/fpmsyncd.cpp b/fpmsyncd/fpmsyncd.cpp index 8308b1df7a0c..106d50e44dd4 100644 --- a/fpmsyncd/fpmsyncd.cpp +++ b/fpmsyncd/fpmsyncd.cpp @@ -40,9 +40,9 @@ int main(int argc, char **argv) { cout << "Connection lost, reconnecting..." << endl; } - catch (...) + catch (const std::exception& e) { - cout << "Exception had been thrown in deamon" << endl; + cout << "Exception \"" << e.what() << "\" had been thrown in deamon" << endl; return 0; } } diff --git a/intfsyncd/intfsyncd.cpp b/intfsyncd/intfsyncd.cpp index 9b4e553a388d..6be4ce0c0120 100644 --- a/intfsyncd/intfsyncd.cpp +++ b/intfsyncd/intfsyncd.cpp @@ -35,9 +35,9 @@ int main(int argc, char **argv) s.select(&temps, &tempfd); } } - catch (...) + catch (const std::exception& e) { - cout << "Exception had been thrown in deamon" << endl; + cout << "Exception \"" << e.what() << "\" had been thrown in deamon" << endl; return 0; } } diff --git a/neighsyncd/neighsyncd.cpp b/neighsyncd/neighsyncd.cpp index 7a39152f11b2..98052015b770 100644 --- a/neighsyncd/neighsyncd.cpp +++ b/neighsyncd/neighsyncd.cpp @@ -35,9 +35,9 @@ int main(int argc, char **argv) s.select(&temps, &tempfd); } } - catch (...) + catch (const std::exception& e) { - cout << "Exception had been thrown in deamon" << endl; + cout << "Exception \"" << e.what() << "\" had been thrown in deamon" << endl; return 0; } } diff --git a/portsyncd/portsyncd.cpp b/portsyncd/portsyncd.cpp index 9cfb703da756..cb14a4f94f30 100644 --- a/portsyncd/portsyncd.cpp +++ b/portsyncd/portsyncd.cpp @@ -124,9 +124,9 @@ int main(int argc, char **argv) } } } - catch (...) + catch (const std::exception& e) { - cerr << "Exception had been thrown in deamon" << endl; + cerr << "Exception \"" << e.what() << "\" had been thrown in deamon" << endl; return EXIT_FAILURE; } diff --git a/teamsyncd/teamsyncd.cpp b/teamsyncd/teamsyncd.cpp index d1eb58134165..7fbbfb2dcc91 100644 --- a/teamsyncd/teamsyncd.cpp +++ b/teamsyncd/teamsyncd.cpp @@ -36,9 +36,9 @@ int main(int argc, char **argv) s.select(&temps, &tempfd); } } - catch (...) + catch (const std::exception& e) { - cout << "Exception had been thrown in deamon" << endl; + cout << "Exception \"" << e.what() << "\" had been thrown in deamon" << endl; return 0; } }