[tracker/tracker-0.16] libtracker-data: Be more explicit in the error message
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/tracker-0.16] libtracker-data: Be more explicit in the error message
- Date: Mon, 13 Oct 2014 14:22:48 +0000 (UTC)
commit 040435f20fb065d2f8cf83b51f9e56afed5cb578
Author: Debarshi Ray <debarshir gnome org>
Date: Mon Oct 13 15:47:09 2014 +0200
libtracker-data: Be more explicit in the error message
Add the sqlite3_errstr() to the error that is propagated from
sqlite3_open_v2 so that we have a clearer picture of the failure.
https://bugzilla.gnome.org/show_bug.cgi?id=738450
src/libtracker-data/tracker-db-interface-sqlite.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/src/libtracker-data/tracker-db-interface-sqlite.c
b/src/libtracker-data/tracker-db-interface-sqlite.c
index 682dd86..beaf9dd 100644
--- a/src/libtracker-data/tracker-db-interface-sqlite.c
+++ b/src/libtracker-data/tracker-db-interface-sqlite.c
@@ -820,6 +820,7 @@ open_database (TrackerDBInterface *db_interface,
GError **error)
{
int mode;
+ int result;
g_assert (db_interface->filename != NULL);
@@ -829,11 +830,15 @@ open_database (TrackerDBInterface *db_interface,
mode = SQLITE_OPEN_READONLY;
}
- if (sqlite3_open_v2 (db_interface->filename, &db_interface->db, mode | SQLITE_OPEN_NOMUTEX, NULL) !=
SQLITE_OK) {
+ result = sqlite3_open_v2 (db_interface->filename, &db_interface->db, mode | SQLITE_OPEN_NOMUTEX,
NULL);
+ if (result != SQLITE_OK) {
+ const gchar *str;
+
+ str = sqlite3_errstr (result);
g_set_error (error,
TRACKER_DB_INTERFACE_ERROR,
TRACKER_DB_OPEN_ERROR,
- "Could not open sqlite3 database:'%s'", db_interface->filename);
+ "Could not open sqlite3 database:'%s': %s", db_interface->filename, str);
return;
} else {
g_message ("Opened sqlite3 database:'%s'", db_interface->filename);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]