Skip to content

Commit 7518ac0

Browse files
committed
Update USPython
1 parent 78462e1 commit 7518ac0

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

USPython.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -501,16 +501,15 @@ def create_usp_agent_with_yaml(file):
501501
if unknown_mtp_type:
502502
for unknown_mtp_type in unknown_mtp_type:
503503
print(f"Unknown MTP type: '{unknown_mtp_type}' is misspelled in the document.")
504-
return
504+
sys.exit(1)
505505

506506
# BETA
507507

508508
if "websockets" in found_mtp_type:
509509

510510
print(f"{colours.yellowColour}\n[!] WebSockets is still on beta. Try it again with MQTT.\n{colours.endColour}")
511511
restore_usp_agent()
512-
sleep(5)
513-
return
512+
sys.exit(1)
514513

515514
# Check for unknown parameter types in the document
516515
valid_parameter_types = {"Read Only", "Read Write"}
@@ -520,7 +519,7 @@ def create_usp_agent_with_yaml(file):
520519
if unknown_parameter_types:
521520
for unknown_parameter_type in unknown_parameter_types:
522521
print(f"Unknown type: '{unknown_parameter_type}' is misspelled in the document.")
523-
return
522+
sys.exit(1)
524523

525524
# Access the data model
526525
seen_parameters = set()
@@ -529,7 +528,7 @@ def create_usp_agent_with_yaml(file):
529528
parameter = element['parameter']
530529
if not parameter.startswith('Device.') or len(parameter.split('.')) < 2:
531530
print(f"Error: Parameter '{parameter}' on line {index} does not start with 'Device.' or is missing component after '.'.")
532-
return
531+
sys.exit(1)
533532

534533
if parameter in seen_parameters:
535534
duplicate_parameters.add(parameter)
@@ -539,7 +538,7 @@ def create_usp_agent_with_yaml(file):
539538
print("Error: Duplicate parameters found:")
540539
for parameter in duplicate_parameters:
541540
print(f" - {parameter}")
542-
return
541+
sys.exit(1)
543542

544543
# CREATE USP AGENT
545544

0 commit comments

Comments
 (0)