improve invalid mode error

This commit is contained in:
xenia 2021-05-12 17:01:55 -04:00
parent fd48e10ff4
commit bd0f41afce
1 changed files with 2 additions and 1 deletions

View File

@ -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)]