summaryrefslogtreecommitdiff
path: root/nephilim/mpd.py
diff options
context:
space:
mode:
authorAnton Khirnov <wyskas@gmail.com>2009-09-20 10:42:24 +0200
committerAnton Khirnov <wyskas@gmail.com>2009-09-20 10:42:24 +0200
commit15c331e7966b824dd1883f707fee7408131bddb9 (patch)
treef5f5e1df766ce567dbe5704b77609999014eeea9 /nephilim/mpd.py
parent48b6568f190dd92fa717af02c37bd806cdbc2624 (diff)
mpd/mpclient: catch socket errors when sending commands
Diffstat (limited to 'nephilim/mpd.py')
-rw-r--r--nephilim/mpd.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/nephilim/mpd.py b/nephilim/mpd.py
index 97aa54f..bcdf3ac 100644
--- a/nephilim/mpd.py
+++ b/nephilim/mpd.py
@@ -144,7 +144,13 @@ class MPDClient(QtCore.QObject):
def _docommand(self, command, args, retval):
if self._commandlist is not None and not callable(retval):
raise CommandListError("%s not allowed in command list" % command)
- self._writecommand(command, args)
+ try:
+ self._writecommand(command, args)
+ except socket.error, e:
+ self.logger.error('Error sending command: %s.'%e)
+ self.disconnect_mpd()
+ return None
+
if self._commandlist is None:
if callable(retval):
return retval()