Skip to content

Commit 0131ce2

Browse files
committed
badfiles: Better logging and error handling (beetbox#2428)
1 parent c09a337 commit 0131ce2

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

beetsplug/badfiles.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,11 @@ def run_command(self, cmd):
4444
status = e.returncode
4545
except OSError as e:
4646
if e.errno == errno.ENOENT:
47-
ui.print_(u"command not found: {}".format(cmd[0]))
48-
sys.exit(1)
47+
raise ui.UserError(u"command not found: {}".format(cmd[0]))
4948
else:
50-
raise
49+
raise ui.UserError(
50+
u"error invoking {}: {}".format(cmd[0], e)
51+
)
5152
output = output.decode(sys.getfilesystemencoding())
5253
return status, errors, [line for line in output.split("\n") if line]
5354

@@ -96,6 +97,7 @@ def check_bad(self, lib, opts, args):
9697
ext = os.path.splitext(item.path)[1][1:]
9798
checker = self.get_checker(ext)
9899
if not checker:
100+
self._log.debug(u"no checker available for {}", ext)
99101
continue
100102
path = item.path
101103
if not isinstance(path, six.text_type):

0 commit comments

Comments
 (0)