database: db_load() returns GError

Do error reporting with GLib's GError library.
This commit is contained in:
Max Kellermann
2009-03-02 15:42:21 +01:00
parent eb5b3ce553
commit c0ffec2fd1
3 changed files with 48 additions and 17 deletions

View File

@@ -94,6 +94,7 @@ openDB(const Options *options)
{
const char *path = config_get_path(CONF_DB_FILE);
bool ret;
GError *error = NULL;
if (!mapper_has_music_directory()) {
if (path != NULL)
@@ -112,8 +113,11 @@ openDB(const Options *options)
/* don't attempt to load the old database */
return false;
ret = db_load();
ret = db_load(&error);
if (!ret) {
g_warning("Failed to load database: %s", error->message);
g_error_free(error);
if (options->createDB < 0)
g_error("can't open db file and using "
"\"--no-create-db\" command line option");