summaryrefslogtreecommitdiff
path: root/src/command/DatabaseCommands.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2016-10-29 10:21:57 +0200
committerMax Kellermann <max@musicpd.org>2016-10-29 10:42:56 +0200
commitfac8edd47aa8f86688e8b7d7d0c6945509954d28 (patch)
treeff10541b17fac1275efd5ec822b24a270d84df48 /src/command/DatabaseCommands.cxx
parent9a9da7b0773b5c4863919b84b2269cfeb605ebaa (diff)
db/Interface: migrate visitor methods from class Error to C++ exceptions
Diffstat (limited to 'src/command/DatabaseCommands.cxx')
-rw-r--r--src/command/DatabaseCommands.cxx78
1 files changed, 26 insertions, 52 deletions
diff --git a/src/command/DatabaseCommands.cxx b/src/command/DatabaseCommands.cxx
index a4d3da179..66d4e580c 100644
--- a/src/command/DatabaseCommands.cxx
+++ b/src/command/DatabaseCommands.cxx
@@ -30,7 +30,6 @@
#include "client/Response.hxx"
#include "tag/Tag.hxx"
#include "util/ConstBuffer.hxx"
-#include "util/Error.hxx"
#include "util/StringAPI.hxx"
#include "SongFilter.hxx"
#include "BulkEdit.hxx"
@@ -41,12 +40,8 @@ CommandResult
handle_listfiles_db(Client &client, Response &r, const char *uri)
{
const DatabaseSelection selection(uri, false);
-
- Error error;
- if (!db_selection_print(r, client.partition,
- selection, false, true, error))
- return print_error(r, error);
-
+ db_selection_print(r, client.partition,
+ selection, false, true);
return CommandResult::OK;
}
@@ -54,12 +49,8 @@ CommandResult
handle_lsinfo2(Client &client, const char *uri, Response &r)
{
const DatabaseSelection selection(uri, false);
-
- Error error;
- if (!db_selection_print(r, client.partition,
- selection, true, false, error))
- return print_error(r, error);
-
+ db_selection_print(r, client.partition,
+ selection, true, false);
return CommandResult::OK;
}
@@ -83,12 +74,10 @@ handle_match(Client &client, Request args, Response &r, bool fold_case)
const DatabaseSelection selection("", true, &filter);
- Error error;
- return db_selection_print(r, client.partition,
- selection, true, false,
- window.start, window.end, error)
- ? CommandResult::OK
- : print_error(r, error);
+ db_selection_print(r, client.partition,
+ selection, true, false,
+ window.start, window.end);
+ return CommandResult::OK;
}
CommandResult
@@ -115,10 +104,8 @@ handle_match_add(Client &client, Request args, Response &r, bool fold_case)
const ScopeBulkEdit bulk_edit(client.partition);
const DatabaseSelection selection("", true, &filter);
- Error error;
- return AddFromDatabase(client.partition, selection, error)
- ? CommandResult::OK
- : print_error(r, error);
+ AddFromDatabase(client.partition, selection);
+ return CommandResult::OK;
}
CommandResult
@@ -144,13 +131,11 @@ handle_searchaddpl(Client &client, Request args, Response &r)
return CommandResult::ERROR;
}
- Error error;
const Database &db = client.GetDatabaseOrThrow();
- return search_add_to_playlist(db, *client.GetStorage(),
- "", playlist, &filter, error)
- ? CommandResult::OK
- : print_error(r, error);
+ search_add_to_playlist(db, *client.GetStorage(),
+ "", playlist, &filter);
+ return CommandResult::OK;
}
CommandResult
@@ -176,10 +161,8 @@ handle_count(Client &client, Request args, Response &r)
return CommandResult::ERROR;
}
- Error error;
- return PrintSongCount(r, client.partition, "", &filter, group, error)
- ? CommandResult::OK
- : print_error(r, error);
+ PrintSongCount(r, client.partition, "", &filter, group);
+ return CommandResult::OK;
}
CommandResult
@@ -188,12 +171,10 @@ handle_listall(Client &client, Request args, Response &r)
/* default is root directory */
const auto uri = args.GetOptional(0, "");
- Error error;
- return db_selection_print(r, client.partition,
- DatabaseSelection(uri, true),
- false, false, error)
- ? CommandResult::OK
- : print_error(r, error);
+ db_selection_print(r, client.partition,
+ DatabaseSelection(uri, true),
+ false, false);
+ return CommandResult::OK;
}
CommandResult
@@ -255,14 +236,9 @@ handle_list(Client &client, Request args, Response &r)
return CommandResult::ERROR;
}
- Error error;
- CommandResult ret =
- PrintUniqueTags(r, client.partition,
- tagType, group_mask, filter.get(), error)
- ? CommandResult::OK
- : print_error(r, error);
-
- return ret;
+ PrintUniqueTags(r, client.partition,
+ tagType, group_mask, filter.get());
+ return CommandResult::OK;
}
CommandResult
@@ -271,10 +247,8 @@ handle_listallinfo(Client &client, Request args, Response &r)
/* default is root directory */
const auto uri = args.GetOptional(0, "");
- Error error;
- return db_selection_print(r, client.partition,
- DatabaseSelection(uri, true),
- true, false, error)
- ? CommandResult::OK
- : print_error(r, error);
+ db_selection_print(r, client.partition,
+ DatabaseSelection(uri, true),
+ true, false);
+ return CommandResult::OK;
}