From d3866475ac6dfc4ef235cab937d8b1de314a6403 Mon Sep 17 00:00:00 2001
From: Steven Murray <Steven.Murray@cern.ch>
Date: Sun, 14 Oct 2018 22:44:23 +0200
Subject: [PATCH] AcsCmdLine::handleUnknownOption() now throws UnknownOption
 instead of InvalidAgument

---
 mediachanger/acs/AcsCmdLine.cpp | 3 +--
 mediachanger/acs/AcsCmdLine.hpp | 9 +++++++++
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/mediachanger/acs/AcsCmdLine.cpp b/mediachanger/acs/AcsCmdLine.cpp
index 2bb552d038..342cd3a10c 100644
--- a/mediachanger/acs/AcsCmdLine.cpp
+++ b/mediachanger/acs/AcsCmdLine.cpp
@@ -17,7 +17,6 @@
  */
 
 #include "AcsCmdLine.hpp"
-#include "common/exception/InvalidArgument.hpp"
 #include "common/exception/MissingOperand.hpp"
 
 #include <stdlib.h>
@@ -170,7 +169,7 @@ void cta::mediachanger::acs::AcsCmdLine::handleMissingParameter(const int opt) {
 // handleUnknownOption
 //------------------------------------------------------------------------------
 void cta::mediachanger::acs::AcsCmdLine::handleUnknownOption(const int opt) {
-  cta::exception::InvalidArgument ex;
+  UnknownOption ex;
   if(0 == optopt) {
     ex.getMessage() << "Unknown command-line option";
   } else {
diff --git a/mediachanger/acs/AcsCmdLine.hpp b/mediachanger/acs/AcsCmdLine.hpp
index b625e3c388..7f806d4cf3 100644
--- a/mediachanger/acs/AcsCmdLine.hpp
+++ b/mediachanger/acs/AcsCmdLine.hpp
@@ -96,10 +96,19 @@ protected:
    */
   void handleMissingParameter(const int opt);
 
+  /**
+   * Unkown option.
+   */
+  struct UnknownOption: public exception::Exception {
+    UnknownOption(const std::string &context = "", const bool embedBacktrace = true):
+      cta::exception::Exception(context, embedBacktrace) {}
+  };
+
   /**
    * Handles the specified unknown option.
    *
    * @param opt The option.
+   * @throw UnknownOption indepedent of the value of opt.
    */
   void handleUnknownOption(const int opt);
 
-- 
GitLab