Skip to content

Commit 999a942

Browse files
committed
[OMCSessionZMQ] allways check for errors if using sendExpression()
needs the preparation / additional changes in OMCSession* and ModelicaSystem
1 parent 5a8987c commit 999a942

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

OMPython/OMCSession.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,17 @@ def sendExpression(self, command, parsed=True):
549549
return None
550550
else:
551551
result = self._omc.recv_string()
552+
553+
# allways check for error
554+
self._omc.send_string("getErrorString()", flags=zmq.NOBLOCK)
555+
error_raw = self._omc.recv_string()
556+
error_str = om_parser_typed(error_raw)
557+
if error_str:
558+
if "Error" in error_str:
559+
raise OMCSessionException(f"OM Error for 'sendExpression({command}, {parsed})': {error_str}")
560+
else:
561+
logger.warning(f"[OM]: {error_str}")
562+
552563
if parsed is True:
553564
try:
554565
return om_parser_typed(result)

0 commit comments

Comments
 (0)