diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2011-02-21 15:11:05 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2011-02-21 15:11:05 +0200 |
commit | 1233c11bf05cc3a039afa548faf06f3610f24269 (patch) | |
tree | fa0a2b394b4b788a5a08fad04fb2526c502be485 | |
parent | 02d943c11ab54e68c1ea6addd23c9852feecd94a (diff) |
Add recoverable, connection_lost, and timeout exceptions
The deadlock exception now inherits from recoverable. New manual section:
3.5, "Error Handling and Recovery".
-rw-r--r-- | odb/exceptions.cxx | 12 | ||||
-rw-r--r-- | odb/exceptions.hxx | 21 |
2 files changed, 32 insertions, 1 deletions
diff --git a/odb/exceptions.cxx b/odb/exceptions.cxx index 27a0e8b..1d4be70 100644 --- a/odb/exceptions.cxx +++ b/odb/exceptions.cxx @@ -55,6 +55,18 @@ namespace odb return "transaction aborted due to deadlock"; } + const char* connection_lost:: + what () const throw () + { + return "connection to database lost"; + } + + const char* timeout:: + what () const throw () + { + return "database operation timeout"; + } + const char* object_not_persistent:: what () const throw () { diff --git a/odb/exceptions.hxx b/odb/exceptions.hxx index 362c7b0..1185876 100644 --- a/odb/exceptions.hxx +++ b/odb/exceptions.hxx @@ -62,7 +62,23 @@ namespace odb // Database operations exceptions. // - struct LIBODB_EXPORT deadlock: exception + struct LIBODB_EXPORT recoverable: exception + { + }; + + struct LIBODB_EXPORT connection_lost: recoverable + { + virtual const char* + what () const throw (); + }; + + struct LIBODB_EXPORT timeout: recoverable + { + virtual const char* + what () const throw (); + }; + + struct LIBODB_EXPORT deadlock: recoverable { virtual const char* what () const throw (); @@ -102,7 +118,10 @@ namespace odb using odb::not_in_session; using odb::const_object; + using odb::recoverable; using odb::deadlock; + using odb::connection_lost; + using odb::timeout; using odb::object_not_persistent; using odb::object_already_persistent; using odb::result_not_cached; |