diff --git a/beets/library.py b/beets/library.py index 15151e9fe..d521fc4a8 100644 --- a/beets/library.py +++ b/beets/library.py @@ -1069,7 +1069,10 @@ def parse_query_string(s, model_cls): # http://bugs.python.org/issue6988 if isinstance(s, unicode): s = s.encode('utf8') - parts = [p.decode('utf8') for p in shlex.split(s)] + try: + parts = [p.decode('utf8') for p in shlex.split(s)] + except ValueError as exc: + raise ValueError("Cannot parse {0!r} (error was: {1})".format(s, exc)) return parse_query_parts(parts, model_cls) diff --git a/docs/changelog.rst b/docs/changelog.rst index 038e6f93d..b8fc19dac 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -86,6 +86,7 @@ Fixes: like the bitrate. :bug:`1268` * The error message when MusicBrainz is not reachable on the network is now much clearer. Thanks to Tom Jaspers. :bug:`1190` :bug:`1272` +* Improve error messages when parsing query strings with shlex. :bug:`1290` For developers: