improve error message parsing by checking regex result
This commit is contained in:
parent
4f64969638
commit
0ac3b3f2da
1 changed files with 8 additions and 5 deletions
13
mcg/mcg.py
13
mcg/mcg.py
|
@ -27,11 +27,14 @@ class MPDException(Exception):
|
|||
|
||||
|
||||
def _parse_error(self, error):
|
||||
parts = re.match("\[(\d+)@(\d+)\]\s\{(\w+)\}\s(.*)", error)
|
||||
self._error = int(parts.group(1))
|
||||
self._command_number = int(parts.group(2))
|
||||
self._command_name = parts.group(3)
|
||||
return parts.group(4)
|
||||
if error:
|
||||
parts = re.match("\[(\d+)@(\d+)\]\s\{(\w+)\}\s(.*)", error)
|
||||
if parts:
|
||||
self._error = int(parts.group(1))
|
||||
self._command_number = int(parts.group(2))
|
||||
self._command_name = parts.group(3)
|
||||
return parts.group(4)
|
||||
return error
|
||||
|
||||
|
||||
def get_error(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue