From 85ffe444dcbc700795f01c0df1e49802063a6d0e Mon Sep 17 00:00:00 2001 From: David Logie Date: Fri, 5 Jun 2015 10:15:06 +0100 Subject: [PATCH] mpdupdate: Improve error message When beets can't connect to mpd, display the underlying error instead of dying with an ugly exception. --- beetsplug/mpdupdate.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/beetsplug/mpdupdate.py b/beetsplug/mpdupdate.py index 1240917bb..a6e14e48e 100644 --- a/beetsplug/mpdupdate.py +++ b/beetsplug/mpdupdate.py @@ -97,7 +97,13 @@ class MPDUpdatePlugin(BeetsPlugin): """ self._log.info('Updating MPD database...') - s = BufferedSocket(host, port) + try: + s = BufferedSocket(host, port) + except socket.error as e: + self._log.warning(u'MPD connection failed: {0}', + unicode(e.strerror)) + return + resp = s.readline() if 'OK MPD' not in resp: self._log.warning(u'MPD connection failed: {0!r}', resp)