queue/PlaylistControl: throw PlaylistError on error
This commit is contained in:
parent
b6cb9b853a
commit
9de984f7f8
@ -228,11 +228,8 @@ playlist::SeekSongPosition(PlayerControl &pc, unsigned song,
|
|||||||
SongTime seek_time,
|
SongTime seek_time,
|
||||||
Error &error)
|
Error &error)
|
||||||
{
|
{
|
||||||
if (!queue.IsValidPosition(song)) {
|
if (!queue.IsValidPosition(song))
|
||||||
error.Set(playlist_domain, int(PlaylistResult::BAD_RANGE),
|
throw PlaylistError::BadRange();
|
||||||
"Bad range");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned i = queue.random
|
unsigned i = queue.random
|
||||||
? queue.PositionToOrder(song)
|
? queue.PositionToOrder(song)
|
||||||
@ -246,11 +243,8 @@ playlist::SeekSongId(PlayerControl &pc, unsigned id, SongTime seek_time,
|
|||||||
Error &error)
|
Error &error)
|
||||||
{
|
{
|
||||||
int song = queue.IdToPosition(id);
|
int song = queue.IdToPosition(id);
|
||||||
if (song < 0) {
|
if (song < 0)
|
||||||
error.Set(playlist_domain, int(PlaylistResult::NO_SUCH_SONG),
|
throw PlaylistError::NoSuchSong();
|
||||||
"No such song");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return SeekSongPosition(pc, song, seek_time, error);
|
return SeekSongPosition(pc, song, seek_time, error);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user