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

@@ -209,12 +209,13 @@ public:
unsigned AppendSong(PlayerControl &pc, DetachedSong &&song);
/**
* @return the new song id or 0 on error
* Throws #std::runtime_error on error.
*
* @return the new song id
*/
unsigned AppendURI(PlayerControl &pc,
const SongLoader &loader,
const char *uri_utf8,
Error &error);
const char *uri_utf8);
protected:
void DeleteInternal(PlayerControl &pc,

View File

@@ -124,13 +124,9 @@ playlist::AppendSong(PlayerControl &pc, DetachedSong &&song)
unsigned
playlist::AppendURI(PlayerControl &pc, const SongLoader &loader,
const char *uri,
Error &error)
const char *uri)
{
std::unique_ptr<DetachedSong> song(loader.LoadSong(uri, error));
if (song == nullptr)
return 0;
std::unique_ptr<DetachedSong> song(loader.LoadSong(uri));
return AppendSong(pc, std::move(*song));
}