From 1233c11bf05cc3a039afa548faf06f3610f24269 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 21 Feb 2011 15:11:05 +0200 Subject: Add recoverable, connection_lost, and timeout exceptions The deadlock exception now inherits from recoverable. New manual section: 3.5, "Error Handling and Recovery". --- odb/exceptions.cxx | 12 ++++++++++++ odb/exceptions.hxx | 21 ++++++++++++++++++++- 2 files changed, 32 insertions(+), 1 deletion(-) 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; -- cgit v1.1