Return 'incorrect arguments' instead of 'unknown command' for known commands that don't match any patterns
This commit is contained in:
parent
0ee8254008
commit
2f9775250a
@ -79,7 +79,10 @@ class MpdFrontend(object):
|
||||
matches = re.match(pattern, request)
|
||||
if matches is not None:
|
||||
return (_request_handlers[pattern], matches.groupdict())
|
||||
raise MpdUnknownCommand(command=request.split(' ')[0])
|
||||
command = request.split(' ')[0]
|
||||
if command in _commands:
|
||||
raise MpdArgError(u'incorrect arguments', command=command)
|
||||
raise MpdUnknownCommand(command=command)
|
||||
|
||||
def handle_response(self, result, add_ok=True):
|
||||
response = []
|
||||
|
||||
@ -993,8 +993,7 @@ class MusicDatabaseHandlerTest(unittest.TestCase):
|
||||
|
||||
def test_list_artist_with_artist_should_fail(self):
|
||||
result = self.h.handle_request(u'list "artist" "anartist"')
|
||||
self.assertEqual(result[0],
|
||||
u'ACK [2@0] {list} should be "Album" for 3 arguments')
|
||||
self.assertEqual(result[0], u'ACK [2@0] {list} incorrect arguments')
|
||||
|
||||
def test_list_album_without_artist(self):
|
||||
result = self.h.handle_request(u'list "album"')
|
||||
|
||||
Loading…
Reference in New Issue
Block a user