queue/PlaylistEdit: throw PlaylistError on error

This commit is contained in:
Max Kellermann
2016-02-28 10:51:07 +01:00
parent 50b930f283
commit b6cb9b853a
7 changed files with 49 additions and 84 deletions

View File

@@ -66,7 +66,7 @@ handle_save(Client &client, Request args, gcc_unused Response &r)
}
CommandResult
handle_load(Client &client, Request args, Response &r)
handle_load(Client &client, Request args, gcc_unused Response &r)
{
RangeArg range = args.ParseOptional(1, RangeArg::All());
@@ -74,12 +74,10 @@ handle_load(Client &client, Request args, Response &r)
Error error;
const SongLoader loader(client);
if (!playlist_open_into_queue(args.front(),
range.start, range.end,
client.playlist,
client.player_control, loader, error))
return print_error(r, error);
playlist_open_into_queue(args.front(),
range.start, range.end,
client.playlist,
client.player_control, loader);
return CommandResult::OK;
}

View File

@@ -54,11 +54,7 @@ AddUri(Client &client, const LocatedUri &uri, Response &r)
return print_error(r, error);
auto &partition = client.partition;
unsigned id = partition.playlist.AppendSong(partition.pc,
std::move(*song), error);
if (id == 0)
return print_error(r, error);
partition.playlist.AppendSong(partition.pc, std::move(*song));
return CommandResult::OK;
}
@@ -186,12 +182,8 @@ handle_rangeid(Client &client, Request args, Response &r)
return CommandResult::ERROR;
}
Error error;
if (!client.partition.playlist.SetSongIdRange(client.partition.pc,
id, start, end,
error))
return print_error(r, error);
client.partition.playlist.SetSongIdRange(client.partition.pc,
id, start, end);
return CommandResult::OK;
}