Skip to content

Commit 8b5fb27

Browse files
committed
[OMParser] remove import sys
1 parent 1f4fe1f commit 8b5fb27

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

OMPython/OMParser.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
Version: 1.0
3333
"""
3434

35-
import sys
3635
from typing import Any
3736

3837
result: dict[str, Any] = {}
@@ -566,8 +565,8 @@ def skip_all_inner_sets(position):
566565
break
567566
pos += 1
568567
if count != 0:
569-
print("\nParser Error: Are you missing one or more '}'s? \n")
570-
sys.exit(1)
568+
raise ValueError("Parser Error: Are you missing one or more '}}'s in string? "
569+
f"(string value: {repr(string)}")
571570

572571
if max_count >= 2:
573572
while position < end_of_main_set:
@@ -745,8 +744,7 @@ def skip_all_inner_sets(position):
745744
else:
746745
return current_set, next_set[0]
747746
else:
748-
print("\nThe following String has no {}s to proceed\n")
749-
print(string)
747+
raise ValueError(f"The following String has no {{}}s to proceed: {repr(string)}!")
750748

751749
# End of get_the_string()
752750

0 commit comments

Comments
 (0)