aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Sulfrian <alexander@sulfrian.net>2010-01-27 03:39:23 +0100
committerAlexander Sulfrian <alexander@sulfrian.net>2013-01-05 17:17:46 +0100
commit90a6675a8eda8f77d504275b982c469b8e2ca2ce (patch)
tree7e415cedc12d185abdfa897c31fe2c971d0b756c
parent0079e977109bfa1a4226bc399fb7888d28292b3c (diff)
downloadusdx-90a6675a8eda8f77d504275b982c469b8e2ca2ce.tar.gz
usdx-90a6675a8eda8f77d504275b982c469b8e2ca2ce.tar.xz
usdx-90a6675a8eda8f77d504275b982c469b8e2ca2ce.zip
renamed MissingSongTagException to MissingTagException and added tag parameter
-rw-r--r--src/base/song.cpp8
-rw-r--r--src/base/song.hpp17
-rw-r--r--test/base/songloading.cpp8
3 files changed, 22 insertions, 11 deletions
diff --git a/src/base/song.cpp b/src/base/song.cpp
index 4185d51b..d4429f04 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 MissingSongTagException("Incomplete Song! Missing Tag.");
+ throw MissingTagException(tag, "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 MissingSongTagException("Incomplete Song! Missing Tag.");
+ throw MissingTagException(tag, "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 MissingSongTagException("Incomplete Song! Missing Tag.");
+ throw MissingTagException(tag, "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 MissingSongTagException("Incomplete Song! Missing Tag.");
+ throw MissingTagException(tag, "Incomplete Song! Missing Tag.");
}
return result;
diff --git a/src/base/song.hpp b/src/base/song.hpp
index 6009cfa9..d831a91e 100644
--- a/src/base/song.hpp
+++ b/src/base/song.hpp
@@ -37,11 +37,22 @@
namespace usdx
{
- class MissingSongTagException : public BaseException
+ class MissingTagException : public BaseException
{
+ private:
+ /**
+ * TODO: Maybe refactor this to separate sub-classes.
+ */
+ const std::string tag;
+
public:
- MissingSongTagException(std::string message) : BaseException(message) {};
- ~MissingSongTagException () throw () {};
+ MissingTagException(const std::string tag,
+ const std::string message) :
+ BaseException(message), tag(tag) {};
+
+ ~MissingTagException () throw () {};
+
+ virtual const std::string& get_tag() const { return tag; };
};
class Song
diff --git a/test/base/songloading.cpp b/test/base/songloading.cpp
index b0eae877..e8fd1bde 100644
--- a/test/base/songloading.cpp
+++ b/test/base/songloading.cpp
@@ -35,10 +35,10 @@ namespace usdx
class SongloadingTest : public CppUnit::TestFixture {
CPPUNIT_TEST_SUITE(SongloadingTest);
CPPUNIT_TEST(testSongloadingTxtHeader);
- CPPUNIT_TEST_EXCEPTION(testSongloadingTxtMissingHeaderFieldArtist, MissingSongTagException);
- CPPUNIT_TEST_EXCEPTION(testSongloadingTxtMissingHeaderFieldTitle, MissingSongTagException);
- CPPUNIT_TEST_EXCEPTION(testSongloadingTxtMissingHeaderFieldMp3, MissingSongTagException);
- CPPUNIT_TEST_EXCEPTION(testSongloadingTxtMissingHeaderFieldBpm, MissingSongTagException);
+ CPPUNIT_TEST_EXCEPTION(testSongloadingTxtMissingHeaderFieldArtist, MissingTagException);
+ CPPUNIT_TEST_EXCEPTION(testSongloadingTxtMissingHeaderFieldTitle, MissingTagException);
+ CPPUNIT_TEST_EXCEPTION(testSongloadingTxtMissingHeaderFieldMp3, MissingTagException);
+ CPPUNIT_TEST_EXCEPTION(testSongloadingTxtMissingHeaderFieldBpm, MissingTagException);
CPPUNIT_TEST_SUITE_END();
private: