summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2015-11-09 18:26:12 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2015-11-09 18:26:12 +0000
commit535fc84bc9d7d5bb177c6ca4d42a17fe594059cd (patch)
tree805711274c6b32db4eb4160dcb2dfe0373e73f8a
parentAdd specific exception for invalid conversions during extract and tests over ... (diff)
downloadlibdbpp-535fc84bc9d7d5bb177c6ca4d42a17fe594059cd.tar.bz2
libdbpp-535fc84bc9d7d5bb177c6ca4d42a17fe594059cd.tar.xz
libdbpp-535fc84bc9d7d5bb177c6ca4d42a17fe594059cd.zip
Add exception messages with adhoc exception
-rw-r--r--libdbpp/selectcommand.cpp13
-rw-r--r--libdbpp/selectcommand.h7
2 files changed, 18 insertions, 2 deletions
diff --git a/libdbpp/selectcommand.cpp b/libdbpp/selectcommand.cpp
index 792af12..d904b35 100644
--- a/libdbpp/selectcommand.cpp
+++ b/libdbpp/selectcommand.cpp
@@ -2,11 +2,24 @@
#include "error.h"
#include <boost/multi_index_container.hpp>
#include <boost/multi_index/ordered_index.hpp>
+#include <buffer.h>
namespace DB {
ColumnIndexOutOfRange::ColumnIndexOutOfRange(unsigned int n) : colNo(n) { }
+ std::string
+ ColumnIndexOutOfRange::message() const throw()
+ {
+ return stringf("Column (%u) index out of range", colNo);
+ }
+
ColumnDoesNotExist::ColumnDoesNotExist(const Glib::ustring & n) : colName(n) { }
+
+ std::string
+ ColumnDoesNotExist::message() const throw()
+ {
+ return stringf("Column (%s) does not exist", colName.c_str());
+ }
};
DB::SelectCommand::SelectCommand(const std::string & sql) :
diff --git a/libdbpp/selectcommand.h b/libdbpp/selectcommand.h
index 8c9af13..e82a532 100644
--- a/libdbpp/selectcommand.h
+++ b/libdbpp/selectcommand.h
@@ -11,18 +11,21 @@
#include <boost/function/function_fwd.hpp>
#include <boost/shared_ptr.hpp>
#include <visibility.h>
+#include <exception.h>
namespace DB {
class Column;
- class ColumnIndexOutOfRange : public Error {
+ class DLL_PUBLIC ColumnIndexOutOfRange : public AdHoc::Exception<Error> {
public:
ColumnIndexOutOfRange(unsigned int n);
+ std::string message() const throw() override;
const unsigned int colNo;
};
- class ColumnDoesNotExist : public Error {
+ class DLL_PUBLIC ColumnDoesNotExist : public AdHoc::Exception<Error> {
public:
ColumnDoesNotExist(const Glib::ustring & n);
+ std::string message() const throw() override;
const Glib::ustring colName;
};