summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2015-10-13 20:07:35 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2015-10-13 20:07:35 +0100
commit13d613709534e5d77798b9ea9ca5594610445420 (patch)
treecfdce9f8df0234278e958508af474a6a5776a382
parentSplit SqlSource into its own files (diff)
downloadslicer-13d613709534e5d77798b9ea9ca5594610445420.tar.bz2
slicer-13d613709534e5d77798b9ea9ca5594610445420.tar.xz
slicer-13d613709534e5d77798b9ea9ca5594610445420.zip
Centralize common exceptions
-rw-r--r--slicer/db/exceptions.cpp6
-rw-r--r--slicer/db/exceptions.h14
-rw-r--r--slicer/db/sqlSelectDeserializer.cpp3
-rw-r--r--slicer/db/sqlSelectDeserializer.h5
-rw-r--r--slicer/db/testSelect.cpp1
5 files changed, 22 insertions, 7 deletions
diff --git a/slicer/db/exceptions.cpp b/slicer/db/exceptions.cpp
new file mode 100644
index 0000000..50099bd
--- /dev/null
+++ b/slicer/db/exceptions.cpp
@@ -0,0 +1,6 @@
+#include "exceptions.h"
+
+namespace Slicer {
+ UnsupportedModelType::UnsupportedModelType() : std::invalid_argument("Unspported model type") { }
+}
+
diff --git a/slicer/db/exceptions.h b/slicer/db/exceptions.h
new file mode 100644
index 0000000..8673627
--- /dev/null
+++ b/slicer/db/exceptions.h
@@ -0,0 +1,14 @@
+#ifndef SLICER_DB_EXCEPTIONS_H
+#define SLICER_DB_EXCEPTIONS_H
+
+#include <stdexcept>
+
+namespace Slicer {
+ class UnsupportedModelType : public std::invalid_argument {
+ public:
+ UnsupportedModelType();
+ };
+}
+
+#endif
+
diff --git a/slicer/db/sqlSelectDeserializer.cpp b/slicer/db/sqlSelectDeserializer.cpp
index d4198b5..ba5f944 100644
--- a/slicer/db/sqlSelectDeserializer.cpp
+++ b/slicer/db/sqlSelectDeserializer.cpp
@@ -1,5 +1,6 @@
#include "sqlSelectDeserializer.h"
#include "sqlSource.h"
+#include "exceptions.h"
#include <boost/algorithm/string/predicate.hpp>
namespace Slicer {
@@ -7,8 +8,6 @@ namespace Slicer {
TooManyRowsReturned::TooManyRowsReturned() : std::runtime_error("Too many rows returned") { }
- UnsupportedModelType::UnsupportedModelType() : std::invalid_argument("Unspported model type") { }
-
SqlSelectDeserializer::SqlSelectDeserializer(DB::SelectCommand & c, IceUtil::Optional<std::string> tc) :
cmd(c),
typeIdColName(tc)
diff --git a/slicer/db/sqlSelectDeserializer.h b/slicer/db/sqlSelectDeserializer.h
index 42a0243..3d73c94 100644
--- a/slicer/db/sqlSelectDeserializer.h
+++ b/slicer/db/sqlSelectDeserializer.h
@@ -16,11 +16,6 @@ namespace Slicer {
TooManyRowsReturned();
};
- class UnsupportedModelType : public std::invalid_argument {
- public:
- UnsupportedModelType();
- };
-
class DLL_PUBLIC SqlSelectDeserializer : public Slicer::Deserializer {
public:
SqlSelectDeserializer(DB::SelectCommand &, IceUtil::Optional<std::string> typeIdCol = IceUtil::Optional<std::string>());
diff --git a/slicer/db/testSelect.cpp b/slicer/db/testSelect.cpp
index 3af5282..da04b82 100644
--- a/slicer/db/testSelect.cpp
+++ b/slicer/db/testSelect.cpp
@@ -6,6 +6,7 @@
#include <definedDirs.h>
#include "sqlSelectDeserializer.h"
#include <types.h>
+#include "exceptions.h"
class StandardMockDatabase : public PQ::Mock {
public: