LocateUri: migrate from class Error to C++ exceptions

This commit is contained in:
Max Kellermann
2016-10-27 21:59:17 +02:00
parent 726fc53e62
commit 6961bd61ca
16 changed files with 74 additions and 132 deletions

View File

@@ -83,16 +83,12 @@ handle_add(Client &client, Request args, Response &r)
here */
uri = "";
Error error;
const auto located_uri = LocateUri(uri, &client,
const auto located_uri = LocateUri(uri, &client
#ifdef ENABLE_DATABASE
nullptr,
, nullptr
#endif
error);
);
switch (located_uri.type) {
case LocatedUri::Type::UNKNOWN:
return print_error(r, error);
case LocatedUri::Type::ABSOLUTE:
case LocatedUri::Type::PATH:
AddUri(client, located_uri);
@@ -112,10 +108,7 @@ handle_addid(Client &client, Request args, Response &r)
const char *const uri = args.front();
const SongLoader loader(client);
Error error;
unsigned added_id = client.partition.AppendURI(loader, uri, error);
if (added_id == 0)
return print_error(r, error);
unsigned added_id = client.partition.AppendURI(loader, uri);
if (args.size == 2) {
unsigned to = args.ParseUnsigned(1);