summaryrefslogtreecommitdiff
path: root/src/playlist/PlaylistQueue.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2016-02-28 10:51:07 +0100
committerMax Kellermann <max@duempel.org>2016-02-28 11:02:36 +0100
commitb6cb9b853a3385650d40cc121a6b4230e5cf81bc (patch)
treef3b9eb4c27f3c907350652184aa309915ffbe6dd /src/playlist/PlaylistQueue.cxx
parent50b930f283c33f01ce43c54216896e7d3736a1c9 (diff)
queue/PlaylistEdit: throw PlaylistError on error
Diffstat (limited to 'src/playlist/PlaylistQueue.cxx')
-rw-r--r--src/playlist/PlaylistQueue.cxx29
1 files changed, 10 insertions, 19 deletions
diff --git a/src/playlist/PlaylistQueue.cxx b/src/playlist/PlaylistQueue.cxx
index 0bd2133ef..f42b191ad 100644
--- a/src/playlist/PlaylistQueue.cxx
+++ b/src/playlist/PlaylistQueue.cxx
@@ -35,12 +35,11 @@
#include <memory>
-bool
+void
playlist_load_into_queue(const char *uri, SongEnumerator &e,
unsigned start_index, unsigned end_index,
playlist &dest, PlayerControl &pc,
- const SongLoader &loader,
- Error &error)
+ const SongLoader &loader)
{
const std::string base_uri = uri != nullptr
? PathTraitsUTF8::GetParent(uri)
@@ -60,20 +59,15 @@ playlist_load_into_queue(const char *uri, SongEnumerator &e,
continue;
}
- unsigned id = dest.AppendSong(pc, std::move(*song), error);
- if (id == 0)
- return false;
+ dest.AppendSong(pc, std::move(*song));
}
-
- return true;
}
-bool
+void
playlist_open_into_queue(const char *uri,
unsigned start_index, unsigned end_index,
playlist &dest, PlayerControl &pc,
- const SongLoader &loader,
- Error &error)
+ const SongLoader &loader)
{
Mutex mutex;
Cond cond;
@@ -83,13 +77,10 @@ playlist_open_into_queue(const char *uri,
loader.GetStorage(),
#endif
mutex, cond));
- if (playlist == nullptr) {
- error.Set(playlist_domain, int(PlaylistResult::NO_SUCH_LIST),
- "No such playlist");
- return false;
- }
+ if (playlist == nullptr)
+ throw PlaylistError::NoSuchList();
- return playlist_load_into_queue(uri, *playlist,
- start_index, end_index,
- dest, pc, loader, error);
+ playlist_load_into_queue(uri, *playlist,
+ start_index, end_index,
+ dest, pc, loader);
}