Skip to content

Commit 37d572b

Browse files
committed
[ModelicaSystem] add missing 'raise' keywords for exceptions
1 parent a6d877d commit 37d572b

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

OMPython/ModelicaSystem.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ def _run_cmd(self, cmd: list, timeout: Optional[int] = None):
286286
# set the process environment from the generated .bat file in windows which should have all the dependencies
287287
batFilePath = pathlib.Path(self.tempdir) / f"{self.modelName}.bat"
288288
if not batFilePath.exists():
289-
ModelicaSystemError("Batch file (*.bat) does not exist " + str(batFilePath))
289+
raise ModelicaSystemError("Batch file (*.bat) does not exist " + str(batFilePath))
290290

291291
with open(batFilePath, 'r') as file:
292292
for line in file:
@@ -351,7 +351,7 @@ def requestApi(self, apiName, entity=None, properties=None): # 2
351351

352352
def xmlparse(self):
353353
if not self.xmlFile.exists():
354-
ModelicaSystemError(f"XML file not generated: {self.xmlFile}")
354+
raise ModelicaSystemError(f"XML file not generated: {self.xmlFile}")
355355

356356
tree = ET.parse(self.xmlFile)
357357
rootCQ = tree.getroot()
@@ -907,11 +907,11 @@ def checkValidInputs(self, name):
907907
if isinstance(l, tuple):
908908
# if l[0] < float(self.simValuesList[0]):
909909
if l[0] < float(self.simulateOptions["startTime"]):
910-
ModelicaSystemError('Input time value is less than simulation startTime')
910+
raise ModelicaSystemError('Input time value is less than simulation startTime')
911911
if len(l) != 2:
912-
ModelicaSystemError(f'Value for {l} is in incorrect format!')
912+
raise ModelicaSystemError(f'Value for {l} is in incorrect format!')
913913
else:
914-
ModelicaSystemError('Error!!! Value must be in tuple format')
914+
raise ModelicaSystemError('Error!!! Value must be in tuple format')
915915

916916
def createCSVData(self) -> pathlib.Path:
917917
start_time: float = float(self.simulateOptions["startTime"])

0 commit comments

Comments
 (0)