metasync: More precise exception catching (#1700)

This commit is contained in:
Adrian Sampson 2015-11-04 20:07:49 -08:00
parent a7952b1b1d
commit be49955884

View file

@ -111,11 +111,13 @@ class MetaSyncPlugin(BeetsPlugin):
# Instantiate the meta sources
for player in sources:
try:
meta_source_instances[player] = \
META_SOURCES[player](self.config, self._log)
cls = META_SOURCES[player]
except KeyError:
self._log.error(u'Unknown metadata source \'{0}\''.format(
player))
try:
meta_source_instances[player] = cls(self.config, self._log)
except (ImportError, ConfigValueError) as e:
self._log.error(u'Failed to instantiate metadata source '
u'\'{0}\': {1}'.format(player, e))