diff options
author | Max Kellermann <max@musicpd.org> | 2016-09-08 10:29:49 +0200 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2016-09-08 12:07:22 +0200 |
commit | 6e52ab285a7d8e94bb3ecda98f3dfa2e35ade0bf (patch) | |
tree | f6d9d4770dfbf84a3be76ba6d421c02528257479 /src/player/Control.cxx | |
parent | 3da464811291bf5434f8e69bc90882f1169ca9be (diff) |
player/Control: use class Error as C++ exception, throw it
Diffstat (limited to 'src/player/Control.cxx')
-rw-r--r-- | src/player/Control.cxx | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/src/player/Control.cxx b/src/player/Control.cxx index 26e4e0210..e495c0d00 100644 --- a/src/player/Control.cxx +++ b/src/player/Control.cxx @@ -49,20 +49,18 @@ PlayerControl::~PlayerControl() delete tagged_song; } -bool -PlayerControl::Play(DetachedSong *song, Error &error_r) +void +PlayerControl::Play(DetachedSong *song) { assert(song != nullptr); const ScopeLock protect(mutex); - bool success = SeekLocked(song, SongTime::zero(), error_r); + SeekLocked(song, SongTime::zero()); - if (success && state == PlayerState::PAUSE) + if (state == PlayerState::PAUSE) /* if the player was paused previously, we need to unpause it */ PauseLocked(); - - return success; } void @@ -203,8 +201,8 @@ PlayerControl::LockEnqueueSong(DetachedSong *song) EnqueueSongLocked(song); } -bool -PlayerControl::SeekLocked(DetachedSong *song, SongTime t, Error &error_r) +void +PlayerControl::SeekLocked(DetachedSong *song, SongTime t) { assert(song != nullptr); @@ -226,28 +224,23 @@ PlayerControl::SeekLocked(DetachedSong *song, SongTime t, Error &error_r) if (error_type != PlayerError::NONE) { assert(error.IsDefined()); - error_r.Set(error); - return false; + throw error; } assert(!error.IsDefined()); - return true; } -bool -PlayerControl::LockSeek(DetachedSong *song, SongTime t, Error &error_r) +void +PlayerControl::LockSeek(DetachedSong *song, SongTime t) { assert(song != nullptr); { const ScopeLock protect(mutex); - if (!SeekLocked(song, t, error_r)) - return false; + SeekLocked(song, t); } idle_add(IDLE_PLAYER); - - return true; } void |