Skip to content

Commit 884adce

Browse files
committed
tweak mpy-cross error message and control flow
1 parent 4e3f4b8 commit 884adce

1 file changed

Lines changed: 4 additions & 7 deletions

File tree

pybricksdev/cli/__init__.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ async def reconnect_hub():
331331

332332
except subprocess.CalledProcessError as e:
333333
print()
334-
print("A syntax error occurred while parsing your program:")
334+
print("mpy-cross failed to compile the program:")
335335
print(e.stderr.decode())
336336

337337
except HubPowerButtonPressedError:
@@ -414,17 +414,14 @@ def is_pybricks_usb(dev):
414414
hub._enable_line_handler = True
415415
await hub.download(script_path)
416416

417-
if args.stay_connected:
418-
await self.stay_connected_menu(hub, args)
419-
420417
except subprocess.CalledProcessError as e:
421418
print()
422-
print("A syntax error occurred while parsing your program:")
419+
print("mpy-cross failed to compile the program:")
423420
print(e.stderr.decode())
424-
if args.stay_connected:
425-
await self.stay_connected_menu(hub, args)
426421

427422
finally:
423+
if args.stay_connected:
424+
await self.stay_connected_menu(hub, args)
428425
await hub.disconnect()
429426

430427

0 commit comments

Comments
 (0)