From 73a0556dca6ff98da2a77a34e75c5eec5969cd87 Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Sun, 5 Sep 2010 18:12:39 +0200 Subject: revised exception hierarchy, following more the pqxx ideas --- include/sqlite3xx/except.hpp | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) (limited to 'include') diff --git a/include/sqlite3xx/except.hpp b/include/sqlite3xx/except.hpp index 2577e85..6a70216 100644 --- a/include/sqlite3xx/except.hpp +++ b/include/sqlite3xx/except.hpp @@ -32,20 +32,40 @@ using namespace std; namespace sqlite3xx { -class SQLITEXX_LIBEXPORT sql_error : runtime_error { - string _m; - string _q; +class SQLITEXX_LIBEXPORT sqlitexx_exception { + public: + virtual ~sqlitexx_exception( ) throw( ) = 0; + + virtual exception &base( ) throw( ) = 0; +}; + +class SQLITEXX_LIBEXPORT failure : public sqlitexx_exception, public runtime_error +{ + virtual exception &base( ) throw( ) { return *this; } + + public: + explicit failure( const string &s ); +}; + +class SQLITEXX_LIBEXPORT sql_error : public failure { + string m_q; public: sql_error( ); - explicit sql_error( string& q ); - explicit sql_error( string& __m, string& q ); + explicit sql_error( const string& _q ); + explicit sql_error( const string& _m, const string& _q ); virtual ~sql_error( ) throw( ); const string& msg( ) const throw( ); const string& query( ) const throw( ); }; +/* +class SQLITEXX_LIBEXPORT db_locked : sql_error { + public: + explicit db_locket( string &q ); +}; +*/ } #endif /* SQLITE3XX_EXCEPT_H */ -- cgit v1.2.3-54-g00ecf