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

encoding of exceptions
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 25 Aug 2015 17:39:38 +0200
parents f967bdf8534e
children b1291df2f780
line wrap: on
line diff
--- a/Core/SQLite/StatementReference.cpp	Tue Aug 25 16:18:37 2015 +0200
+++ b/Core/SQLite/StatementReference.cpp	Tue Aug 25 17:39:38 2015 +0200
@@ -72,7 +72,7 @@
     {
       if (database == NULL || sql == NULL)
       {
-        throw OrthancSQLiteException("Parameter out of range");
+        throw OrthancSQLiteException(ErrorCode_ParameterOutOfRange);
       }
 
       root_ = NULL;
@@ -81,7 +81,11 @@
       int error = sqlite3_prepare_v2(database, sql, -1, &statement_, NULL);
       if (error != SQLITE_OK)
       {
-        throw OrthancSQLiteException("SQLite: " + std::string(sqlite3_errmsg(database)));
+#if ORTHANC_SQLITE_STANDALONE != 1
+        LOG(ERROR) << "SQLite: " << sqlite3_errmsg(database);
+#endif
+
+        throw OrthancSQLiteException(ErrorCode_SQLitePrepareStatement);
       }
 
       assert(IsRoot());