From 59d93dc31774d475a1439a3e26c8315a2e3c4612 Mon Sep 17 00:00:00 2001 From: Steven Murray <Steven.Murray@cern.ch> Date: Sun, 14 Oct 2018 17:09:47 +0200 Subject: [PATCH] AcsCmdLine::parseQueryInterval() now throws InvalidQueryInterval instead of InvalidAgument --- mediachanger/acs/AcsCmdLine.cpp | 2 +- mediachanger/acs/AcsCmdLine.hpp | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/mediachanger/acs/AcsCmdLine.cpp b/mediachanger/acs/AcsCmdLine.cpp index 982820a62c..b04924fb67 100644 --- a/mediachanger/acs/AcsCmdLine.cpp +++ b/mediachanger/acs/AcsCmdLine.cpp @@ -134,7 +134,7 @@ bool cta::mediachanger::acs::AcsCmdLine::onlyContainsNumerals(const std::string int cta::mediachanger::acs::AcsCmdLine::parseQueryInterval(const std::string &s) { const int queryInterval = atoi(s.c_str()); if(0 >= queryInterval) { - cta::exception::InvalidArgument ex; + InvalidQueryInterval ex; ex.getMessage() << "Query value must be an integer greater than 0" ": value=" << queryInterval; throw ex; diff --git a/mediachanger/acs/AcsCmdLine.hpp b/mediachanger/acs/AcsCmdLine.hpp index 8d88a1899a..8fcda5c996 100644 --- a/mediachanger/acs/AcsCmdLine.hpp +++ b/mediachanger/acs/AcsCmdLine.hpp @@ -57,10 +57,19 @@ public: protected: + /** + * Invalid query interval. + */ + struct InvalidQueryInterval: public exception::Exception { + InvalidQueryInterval(const std::string &context = "", const bool embedBacktrace = true): + cta::exception::Exception(context, embedBacktrace) {} + }; + /** * Parses the specified query interval. * * @return The parse query interval. + * @throw InvalidQueryInterval if the query interval is invalid. */ int parseQueryInterval(const std::string &s); -- GitLab