improve invalid mode error
This commit is contained in:
parent
fd48e10ff4
commit
bd0f41afce
|
@ -104,7 +104,8 @@ async def megacom(tty: str, baud: int, mode: str) -> None:
|
||||||
|
|
||||||
m = MODE_RE.match(mode)
|
m = MODE_RE.match(mode)
|
||||||
if m is None:
|
if m is None:
|
||||||
raise Exception(f"invalid mode: {mode}")
|
sys.stderr.write(f"invalid mode: {mode}\n")
|
||||||
|
sys.exit(1)
|
||||||
bytesize = MODE_LOOKUP["bytesize"][m.group(1)]
|
bytesize = MODE_LOOKUP["bytesize"][m.group(1)]
|
||||||
parity = MODE_LOOKUP["parity"][m.group(2)]
|
parity = MODE_LOOKUP["parity"][m.group(2)]
|
||||||
stopbits = MODE_LOOKUP["stopbits"][m.group(3)]
|
stopbits = MODE_LOOKUP["stopbits"][m.group(3)]
|
||||||
|
|
Loading…
Reference in New Issue