aboutsummaryrefslogtreecommitdiffstats
path: root/src/DatabaseGlue.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-08-10 18:02:44 +0200
committerMax Kellermann <max@duempel.org>2013-09-04 18:14:22 +0200
commit29030b54c98b0aee65fbc10ebf7ba36bed98c02c (patch)
tree79766830b55ebca38ddbce84d8d548227eedb69e /src/DatabaseGlue.cxx
parentc9fcc7f14860777458153eb2d13c773ccfa1daa2 (diff)
downloadmpd-29030b54c98b0aee65fbc10ebf7ba36bed98c02c.tar.gz
mpd-29030b54c98b0aee65fbc10ebf7ba36bed98c02c.tar.xz
mpd-29030b54c98b0aee65fbc10ebf7ba36bed98c02c.zip
util/Error: new error passing library
Replaces GLib's GError.
Diffstat (limited to '')
-rw-r--r--src/DatabaseGlue.cxx20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/DatabaseGlue.cxx b/src/DatabaseGlue.cxx
index 70b7acc9e..fb944dacc 100644
--- a/src/DatabaseGlue.cxx
+++ b/src/DatabaseGlue.cxx
@@ -24,6 +24,7 @@
#include "DatabaseSave.hxx"
#include "DatabaseError.hxx"
#include "Directory.hxx"
+#include "util/Error.hxx"
#include "conf.h"
extern "C" {
@@ -50,7 +51,7 @@ static bool db_is_open;
static bool is_simple;
bool
-DatabaseGlobalInit(const config_param &param, GError **error_r)
+DatabaseGlobalInit(const config_param &param, Error &error)
{
assert(db == NULL);
assert(!db_is_open);
@@ -61,12 +62,12 @@ DatabaseGlobalInit(const config_param &param, GError **error_r)
const DatabasePlugin *plugin = GetDatabasePluginByName(plugin_name);
if (plugin == NULL) {
- g_set_error(error_r, db_quark(), 0,
- "No such database plugin: %s", plugin_name);
+ error.Format(db_domain,
+ "No such database plugin: %s", plugin_name);
return false;
}
- db = plugin->create(param, error_r);
+ db = plugin->create(param, error);
return db != NULL;
}
@@ -89,13 +90,12 @@ GetDatabase()
}
const Database *
-GetDatabase(GError **error_r)
+GetDatabase(Error &error)
{
assert(db == nullptr || db_is_open);
if (db == nullptr)
- g_set_error_literal(error_r, db_quark(), DB_DISABLED,
- "No database");
+ error.Set(db_domain, DB_DISABLED, "No database");
return db;
}
@@ -131,17 +131,17 @@ db_get_directory(const char *name)
}
bool
-db_save(GError **error_r)
+db_save(Error &error)
{
assert(db != NULL);
assert(db_is_open);
assert(db_is_simple());
- return ((SimpleDatabase *)db)->Save(error_r);
+ return ((SimpleDatabase *)db)->Save(error);
}
bool
-DatabaseGlobalOpen(GError **error)
+DatabaseGlobalOpen(Error &error)
{
assert(db != NULL);
assert(!db_is_open);