diff --git a/mediachanger/acs/Acs.cpp b/mediachanger/acs/Acs.cpp index 61f701ceb926731e9942c245f8db68aa481bda6c..9e039e9245aa67534b2e2058cc3bbd5aba41f804 100644 --- a/mediachanger/acs/Acs.cpp +++ b/mediachanger/acs/Acs.cpp @@ -50,7 +50,7 @@ DRIVEID cta::mediachanger::acs::Acs::alpd2DriveId(const uint32_t acs, //------------------------------------------------------------------------------ VOLID cta::mediachanger::acs::Acs::str2Volid(const std::string &str) { if(EXTERNAL_LABEL_SIZE < str.length()) { - cta::exception::InvalidArgument ex; + InvalidVolid ex; ex.getMessage() << "Failed to convert string to volume identifier" ": String is longer than the " << EXTERNAL_LABEL_SIZE << " character maximum"; diff --git a/mediachanger/acs/Acs.hpp b/mediachanger/acs/Acs.hpp index 5cb1ccaa659ed6d6391a60fb0b30aae20befaabf..a334210813ea924139383b564af23359594257f8 100644 --- a/mediachanger/acs/Acs.hpp +++ b/mediachanger/acs/Acs.hpp @@ -18,7 +18,8 @@ #pragma once -#include "common/exception/InvalidArgument.hpp" +#include "common/exception/Exception.hpp" + extern "C" { #include "acssys.h" #include "acsapi.h" @@ -55,14 +56,20 @@ public: static DRIVEID alpd2DriveId(const uint32_t acs, const uint32_t lsm, const uint32_t panel, const uint32_t drive); + /** + * Invalid volume identifier. + */ + struct InvalidVolid: public exception::Exception { + InvalidVolid(const std::string &context = "", const bool embedBacktrace = true): + cta::exception::Exception(context, embedBacktrace) {} + }; + /** * Returns the VOLID equibvalent of the specified string. * - * This method throws a cta::exception::InvalidArgument if the string is - * longer than EXTERNAL_LABEL_SIZE. - * * @param str The string representation of the volume identifier. * @return The VOLID representation of the volume identifier. + * @throw InvalidVolid if the string is longer than EXTERNAL_LABEL_SIZE. */ static VOLID str2Volid(const std::string &str);