aboutsummaryrefslogtreecommitdiffstats
path: root/src/base/songloading
diff options
context:
space:
mode:
authorAlexander Sulfrian <alexander@sulfrian.net>2010-01-20 03:43:31 +0100
committerAlexander Sulfrian <alexander@sulfrian.net>2013-01-05 17:17:45 +0100
commit22aa1302d76342c7c4b56b7380734a7f984e7411 (patch)
treea75880a07b4c32967bc01d3e2d39231f6054d4e3 /src/base/songloading
parentc139750658c14e8e0a2621044473810027486f50 (diff)
downloadusdx-22aa1302d76342c7c4b56b7380734a7f984e7411.tar.gz
usdx-22aa1302d76342c7c4b56b7380734a7f984e7411.tar.xz
usdx-22aa1302d76342c7c4b56b7380734a7f984e7411.zip
added custom exception classes for better catching them (gotta catch 'em all)
Diffstat (limited to 'src/base/songloading')
-rw-r--r--src/base/songloading/songloader.cpp4
-rw-r--r--src/base/songloading/songloader.hpp8
2 files changed, 10 insertions, 2 deletions
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: