Skip to content

Commit c38385e

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

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

OMPython/OMCSession.py

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

0 commit comments

Comments
 (0)