mpdupdate: Improve error message

When beets can't connect to mpd, display the underlying error instead of
dying with an ugly exception.
This commit is contained in:
David Logie 2015-06-05 10:15:06 +01:00
parent 93190ac089
commit 85ffe444dc

View file

@ -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)