db/Interface: migrate visitor methods from class Error to C++ exceptions
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user