[Pkg-running-devel] [antpm] 11/20: antpm: exception safety

Kristof Ralovich ralovich-guest at moszumanska.debian.org
Sun Jun 28 12:26:51 UTC 2015


This is an automated email from the git hooks/post-receive script.

ralovich-guest pushed a commit to branch upstream
in repository antpm.

commit 613201ed08f54e1677605b0850a7c57790829c01
Author: RALOVICH, Kristof <tade60 at freemail.hu>
Date:   Sun May 31 19:07:29 2015 +0200

    antpm: exception safety
---
 src/antpm-downloader.cpp |  5 +++++
 src/antpm-fit2gpx.cpp    | 16 +++++++++++-----
 src/antpm-usbmon2ant.cpp |  6 ++++++
 3 files changed, 22 insertions(+), 5 deletions(-)

diff --git a/src/antpm-downloader.cpp b/src/antpm-downloader.cpp
index 6c7f5d9..1bdea95 100644
--- a/src/antpm-downloader.cpp
+++ b/src/antpm-downloader.cpp
@@ -186,6 +186,11 @@ main(int argc, char** argv)
     cerr << desc << "\n";
     return EXIT_FAILURE;
   }
+  catch(boost::exception& e)
+  {
+    cerr << boost::diagnostic_information(e) << std::endl;
+    return EXIT_FAILURE;
+  }
   catch(std::exception& ex)
   {
     cerr << ex.what() << "\n";
diff --git a/src/antpm-fit2gpx.cpp b/src/antpm-fit2gpx.cpp
index d78b25f..c5974f1 100644
--- a/src/antpm-fit2gpx.cpp
+++ b/src/antpm-fit2gpx.cpp
@@ -29,6 +29,7 @@
 
 #include <boost/program_options.hpp>
 #include <boost/filesystem.hpp>
+#include <boost/exception/diagnostic_information.hpp>
 
 namespace po = boost::program_options;
 namespace fs = boost::filesystem;
@@ -91,7 +92,11 @@ main(int argc, char** argv)
   bool        fixLastWrt = false;
   int         verbosityLevel = antpm::Log::instance()->getLogReportingLevel();
   po::options_description desc("Allowed options");
-  desc.add_options()
+  std::vector<const char*> args(argv, argv+argc);
+  po::variables_map vm;
+  try
+  {
+    desc.add_options()
     ("help,h",                                                  "produce help message")
     ("fitFolder,F",      po::value<std::string>(&fitFolder),    "Folder with FIT files")
     ("decode-fit-root,D", po::value<std::string>(&fitRootFile), "FIT file, encoding the root directory contents on a device, e.g. /tmp/0000.fit")
@@ -100,10 +105,6 @@ main(int argc, char** argv)
     ("version,V",                                               "Print version information")
     ;
 
-  std::vector<const char*> args(argv, argv+argc);
-  po::variables_map vm;
-  try
-  {
     //po::parsed_options parsed = po::parse_command_line(argc, argv, desc);
     po::parsed_options parsed = po::command_line_parser(argc, argv).options(desc).run();
     po::store(parsed, vm);
@@ -115,6 +116,11 @@ main(int argc, char** argv)
     cerr << desc << "\n";
     return EXIT_FAILURE;
   }
+  catch(boost::exception& e)
+  {
+    cerr << boost::diagnostic_information(e) << std::endl;
+    return EXIT_FAILURE;
+  }
   catch(std::exception& ex)
   {
     cerr << ex.what() << "\n";
diff --git a/src/antpm-usbmon2ant.cpp b/src/antpm-usbmon2ant.cpp
index a7aae53..68e4192 100644
--- a/src/antpm-usbmon2ant.cpp
+++ b/src/antpm-usbmon2ant.cpp
@@ -27,6 +27,7 @@
 #include "Log.hpp"
 
 #include <boost/program_options.hpp>
+#include <boost/exception/diagnostic_information.hpp>
 
 namespace po = boost::program_options;
 using namespace std;
@@ -90,6 +91,11 @@ main(int argc, char** argv)
     cerr << desc << "\n";
     return EXIT_FAILURE;
   }
+  catch(boost::exception& e)
+  {
+    cerr << boost::diagnostic_information(e) << std::endl;
+    return EXIT_FAILURE;
+  }
   catch(std::exception& ex)
   {
     cerr << ex.what() << "\n";

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-running/antpm.git



More information about the Pkg-running-devel mailing list