aboutsummaryrefslogtreecommitdiffstats
path: root/src/PlayerControl.hxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-10-17 19:34:59 +0200
committerMax Kellermann <max@duempel.org>2013-10-17 19:34:59 +0200
commitffea268d2e0a36fbc7a16f5fe14c7554a2eb56b3 (patch)
treec60a7be32e42d0cdcc7108aa64e513916b575d46 /src/PlayerControl.hxx
parent8e676db633aa8888c8408a91ef219d2261ef42e2 (diff)
downloadmpd-ffea268d2e0a36fbc7a16f5fe14c7554a2eb56b3.tar.gz
mpd-ffea268d2e0a36fbc7a16f5fe14c7554a2eb56b3.tar.xz
mpd-ffea268d2e0a36fbc7a16f5fe14c7554a2eb56b3.zip
PlayerControl: GetError() returns an Error, not a char*
Diffstat (limited to 'src/PlayerControl.hxx')
-rw-r--r--src/PlayerControl.hxx28
1 files changed, 23 insertions, 5 deletions
diff --git a/src/PlayerControl.hxx b/src/PlayerControl.hxx
index b33462a5c..b2b2087e2 100644
--- a/src/PlayerControl.hxx
+++ b/src/PlayerControl.hxx
@@ -325,14 +325,32 @@ public:
*/
void SetError(PlayerError type, Error &&error);
- void ClearError();
+ /**
+ * Checks whether an error has occurred, and if so, returns a
+ * copy of the #Error object.
+ *
+ * Caller must lock the object.
+ */
+ gcc_pure
+ Error GetError() const {
+ Error result;
+ if (error_type != PlayerError::NONE)
+ result.Set(error);
+ return result;
+ }
/**
- * Returns the human-readable message describing the last
- * error during playback, NULL if no error occurred. The
- * caller has to free the returned string.
+ * Like GetError(), but locks and unlocks the object.
*/
- char *GetErrorMessage() const;
+ gcc_pure
+ Error LockGetError() const {
+ Lock();
+ Error result = GetError();
+ Unlock();
+ return result;
+ }
+
+ void ClearError();
PlayerError GetErrorType() const {
return error_type;