Remote control: Improve create-marker error messages
No more missing color errors when text/regex are missing. Use `mark group` in error messages instead of `color`.
This commit is contained in:
parent
8638e42135
commit
aacb4db2dc
@ -329,13 +329,13 @@ def parse_marker_spec(ftype: str, parts: Sequence[str]) -> Tuple[str, Union[str,
|
|||||||
if ftype.startswith('i'):
|
if ftype.startswith('i'):
|
||||||
flags |= re.IGNORECASE
|
flags |= re.IGNORECASE
|
||||||
if not parts or len(parts) % 2 != 0:
|
if not parts or len(parts) % 2 != 0:
|
||||||
raise ValueError('No color specified in marker: {}'.format(' '.join(parts)))
|
raise ValueError('Mark group number and text/regex are not specified in pairs: {}'.format(' '.join(parts)))
|
||||||
ans = []
|
ans = []
|
||||||
for i in range(0, len(parts), 2):
|
for i in range(0, len(parts), 2):
|
||||||
try:
|
try:
|
||||||
color = max(1, min(int(parts[i]), 3))
|
color = max(1, min(int(parts[i]), 3))
|
||||||
except Exception:
|
except Exception:
|
||||||
raise ValueError(f'color {parts[i]} in marker specification is not an integer')
|
raise ValueError(f'Mark group in marker specification is not an integer: {parts[i]}')
|
||||||
sspec = parts[i + 1]
|
sspec = parts[i + 1]
|
||||||
if 'regex' not in ftype:
|
if 'regex' not in ftype:
|
||||||
sspec = re.escape(sspec)
|
sspec = re.escape(sspec)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user