diff options
author | Max Kellermann <max@duempel.org> | 2016-02-28 11:04:35 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2016-02-28 11:04:35 +0100 |
commit | 9de984f7f8ea98fcac544ad3dc046d0a57dccfba (patch) | |
tree | 55090e6b1cde7ebb83f6f4b556b15ae5ca879ffa /src/queue | |
parent | b6cb9b853a3385650d40cc121a6b4230e5cf81bc (diff) |
queue/PlaylistControl: throw PlaylistError on error
Diffstat (limited to 'src/queue')
-rw-r--r-- | src/queue/PlaylistControl.cxx | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/src/queue/PlaylistControl.cxx b/src/queue/PlaylistControl.cxx index 5310a0fa1..3c7a69c61 100644 --- a/src/queue/PlaylistControl.cxx +++ b/src/queue/PlaylistControl.cxx @@ -228,11 +228,8 @@ playlist::SeekSongPosition(PlayerControl &pc, unsigned song, SongTime seek_time, Error &error) { - if (!queue.IsValidPosition(song)) { - error.Set(playlist_domain, int(PlaylistResult::BAD_RANGE), - "Bad range"); - return false; - } + if (!queue.IsValidPosition(song)) + throw PlaylistError::BadRange(); unsigned i = queue.random ? queue.PositionToOrder(song) @@ -246,11 +243,8 @@ playlist::SeekSongId(PlayerControl &pc, unsigned id, SongTime seek_time, Error &error) { int song = queue.IdToPosition(id); - if (song < 0) { - error.Set(playlist_domain, int(PlaylistResult::NO_SUCH_SONG), - "No such song"); - return false; - } + if (song < 0) + throw PlaylistError::NoSuchSong(); return SeekSongPosition(pc, song, seek_time, error); } |