diff options
Diffstat (limited to 'src/base')
-rw-r--r-- | src/base/song.cpp | 8 | ||||
-rw-r--r-- | src/base/song.hpp | 8 | ||||
-rw-r--r-- | src/base/songloading/songloader.cpp | 4 | ||||
-rw-r--r-- | src/base/songloading/songloader.hpp | 8 |
4 files changed, 22 insertions, 6 deletions
diff --git a/src/base/song.cpp b/src/base/song.cpp index 3d825bf4..4185d51b 100644 --- a/src/base/song.cpp +++ b/src/base/song.cpp @@ -108,7 +108,7 @@ namespace usdx } else if (required) { LOG4CXX_ERROR(log, "Incomplete Song! Missing '" << tag << "' Tag in: '" << get_filename() << "'"); - throw "Incomplete Song! Missing Tag."; + throw MissingSongTagException("Incomplete Song! Missing Tag."); } return result; @@ -125,7 +125,7 @@ namespace usdx } else if (required) { LOG4CXX_ERROR(log, "Incomplete Song! Missing '" << tag << "' Tag in: '" << get_filename() << "'"); - throw "Incomplete Song! Missing Tag."; + throw MissingSongTagException("Incomplete Song! Missing Tag."); } return result; @@ -143,7 +143,7 @@ namespace usdx } else if (required) { LOG4CXX_ERROR(log, "Incomplete Song! Missing '" << tag << "' Tag in: '" << get_filename() << "'"); - throw "Incomplete Song! Missing Tag."; + throw MissingSongTagException("Incomplete Song! Missing Tag."); } return result; @@ -164,7 +164,7 @@ namespace usdx } else if (required) { LOG4CXX_ERROR(log, "Incomplete Song! Missing '" << tag << "' Tag in: '" << get_filename() << "'"); - throw "Incomplete Song! Missing Tag."; + throw MissingSongTagException("Incomplete Song! Missing Tag."); } return result; diff --git a/src/base/song.hpp b/src/base/song.hpp index d7ed8c98..6009cfa9 100644 --- a/src/base/song.hpp +++ b/src/base/song.hpp @@ -33,9 +33,17 @@ #include <log4cxx/logger.h> #include "bpm.hpp" #include "lyric_line.hpp" +#include "utils/base_exception.hpp" namespace usdx { + class MissingSongTagException : public BaseException + { + public: + MissingSongTagException(std::string message) : BaseException(message) {}; + ~MissingSongTagException () throw () {}; + }; + class Song { private: diff --git a/src/base/songloading/songloader.cpp b/src/base/songloading/songloader.cpp index 0b1e34ad..c5c595d4 100644 --- a/src/base/songloading/songloader.cpp +++ b/src/base/songloading/songloader.cpp @@ -74,7 +74,7 @@ namespace usdx std::map<std::string, SongloadingStrategy*>::iterator it = strategies.find(extension); if (it == strategies.end()) { LOG4CXX_WARN(log, "No SongloadingStrategy found for file extension: '" << extension << "'"); - throw "Unknown file format."; + throw NoStrategyException("Unknown file format."); } return it->second->load_header(filename); @@ -92,7 +92,7 @@ namespace usdx std::map<std::string, SongloadingStrategy*>::iterator it = strategies.find(extension); if (it == strategies.end()) { LOG4CXX_WARN(log, "No SongloadingStrategy found for file extension: '" << extension << "'"); - throw "Unknown file format."; + throw NoStrategyException("Unknown file format."); } return it->second->load_song(song); diff --git a/src/base/songloading/songloader.hpp b/src/base/songloading/songloader.hpp index 41f7e034..bbe7dfcb 100644 --- a/src/base/songloading/songloader.hpp +++ b/src/base/songloading/songloader.hpp @@ -31,9 +31,17 @@ #include <log4cxx/logger.h> #include "songloading_strategy.hpp" #include "song.hpp" +#include "utils/base_exception.hpp" namespace usdx { + class NoStrategyException : public BaseException + { + public: + NoStrategyException(std::string message) : BaseException(message) {}; + ~NoStrategyException () throw () {}; + }; + class Songloader { private: |