diff Core/SQLite/Transaction.cpp @ 1582:bd1889029cbb

encoding of exceptions
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 25 Aug 2015 17:39:38 +0200
parents 63d47b1fa239
children b1291df2f780
line wrap: on
line diff
--- a/Core/SQLite/Transaction.cpp	Tue Aug 25 16:18:37 2015 +0200
+++ b/Core/SQLite/Transaction.cpp	Tue Aug 25 17:39:38 2015 +0200
@@ -64,13 +64,13 @@
     {
       if (isOpen_) 
       {
-        throw OrthancSQLiteException("SQLite: Beginning a transaction twice!");
+        throw OrthancSQLiteException(ErrorCode_SQLiteTransactionAlreadyStarted);
       }
 
       isOpen_ = connection_.BeginTransaction();
       if (!isOpen_)
       {
-        throw OrthancSQLiteException("SQLite: Unable to create a transaction");
+        throw OrthancSQLiteException(ErrorCode_SQLiteTransactionBegin);
       }
     }
 
@@ -78,8 +78,7 @@
     {
       if (!isOpen_) 
       {
-        throw OrthancSQLiteException("SQLite: Attempting to roll back a nonexistent transaction. "
-                                     "Did you remember to call Begin()?");
+        throw OrthancSQLiteException(ErrorCode_SQLiteRollbackWithoutTransaction);
       }
 
       isOpen_ = false;
@@ -91,15 +90,14 @@
     {
       if (!isOpen_) 
       {
-        throw OrthancSQLiteException("SQLite: Attempting to roll back a nonexistent transaction. "
-                                     "Did you remember to call Begin()?");
+        throw OrthancSQLiteException(ErrorCode_SQLiteRollbackWithoutTransaction);
       }
 
       isOpen_ = false;
 
       if (!connection_.CommitTransaction())
       {
-        throw OrthancSQLiteException("SQLite: Failure when committing the transaction");
+        throw OrthancSQLiteException(ErrorCode_SQLiteTransactionCommit);
       }
     }
   }