aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--odb/exception.cxx17
-rw-r--r--odb/exception.hxx4
-rw-r--r--odb/exceptions.cxx35
-rw-r--r--odb/exceptions.hxx12
-rw-r--r--odb/makefile1
5 files changed, 48 insertions, 21 deletions
diff --git a/odb/exception.cxx b/odb/exception.cxx
deleted file mode 100644
index 330e70a..0000000
--- a/odb/exception.cxx
+++ /dev/null
@@ -1,17 +0,0 @@
-// file : odb/exception.cxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// copyright : Copyright (c) 2009-2010 Code Synthesis Tools CC
-// license : GNU GPL v2; see accompanying LICENSE file
-
-#include <typeinfo>
-
-#include <odb/exception.hxx>
-
-namespace odb
-{
- const char* exception::
- what () const throw ()
- {
- return typeid (*this).name ();
- }
-}
diff --git a/odb/exception.hxx b/odb/exception.hxx
index 0ab188a..e0217b7 100644
--- a/odb/exception.hxx
+++ b/odb/exception.hxx
@@ -16,10 +16,8 @@ namespace odb
{
struct LIBODB_EXPORT exception: std::exception
{
- // By default return the exception type name ( typeid (*this).name () ).
- //
virtual const char*
- what () const throw ();
+ what () const throw () = 0;
};
}
diff --git a/odb/exceptions.cxx b/odb/exceptions.cxx
index d86657c..b27cc37 100644
--- a/odb/exceptions.cxx
+++ b/odb/exceptions.cxx
@@ -7,4 +7,39 @@
namespace odb
{
+ const char* already_in_transaction::
+ what () const throw ()
+ {
+ return "transaction already in progress in this thread";
+ }
+
+ const char* not_in_transaction::
+ what () const throw ()
+ {
+ return "operation can only be performed in transaction";
+ }
+
+ const char* transaction_already_finilized::
+ what () const throw ()
+ {
+ return "transaction already committed or rolled back";
+ }
+
+ const char* deadlock::
+ what () const throw ()
+ {
+ return "transaction aborted due to deadlock";
+ }
+
+ const char* object_not_persistent::
+ what () const throw ()
+ {
+ return "object not persistent";
+ }
+
+ const char* object_already_persistent::
+ what () const throw ()
+ {
+ return "object already persistent";
+ }
}
diff --git a/odb/exceptions.hxx b/odb/exceptions.hxx
index ff97873..8c9e826 100644
--- a/odb/exceptions.hxx
+++ b/odb/exceptions.hxx
@@ -16,26 +16,38 @@ namespace odb
{
struct LIBODB_EXPORT already_in_transaction: odb::exception
{
+ virtual const char*
+ what () const throw ();
};
struct LIBODB_EXPORT not_in_transaction: odb::exception
{
+ virtual const char*
+ what () const throw ();
};
struct LIBODB_EXPORT transaction_already_finilized: odb::exception
{
+ virtual const char*
+ what () const throw ();
};
struct LIBODB_EXPORT deadlock: odb::exception
{
+ virtual const char*
+ what () const throw ();
};
struct LIBODB_EXPORT object_not_persistent: odb::exception
{
+ virtual const char*
+ what () const throw ();
};
struct LIBODB_EXPORT object_already_persistent: odb::exception
{
+ virtual const char*
+ what () const throw ();
};
struct LIBODB_EXPORT database_exception: odb::exception
diff --git a/odb/makefile b/odb/makefile
index 7197d82..15439da 100644
--- a/odb/makefile
+++ b/odb/makefile
@@ -6,7 +6,6 @@
include $(dir $(lastword $(MAKEFILE_LIST)))../build/bootstrap.make
cxx := \
-exception.cxx \
exceptions.cxx \
database.cxx \
transaction.cxx