Skip to content

Commit e558ff8

Browse files
author
debsankha manik
committed
control flow is given back to the interpreter when simulation is aborted due to a c++ exception
1 parent b038160 commit e558ff8

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

devs/cadevs.pxd

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,5 +103,6 @@ cdef extern from "adevs_python.hpp" namespace "pydevs":
103103
Simulator(Atomic*) except +
104104
Simulator(Digraph*) except +
105105
Time nextEventTime() except *
106-
void executeNextEvent() except *
107-
void executeUntil(Time) except *
106+
void executeNextEvent() except +* # the +* signifies this can raise
107+
# both python and c++ exceptions
108+
void executeUntil(Time) except +*

test_exceptions/error_throwing_model.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,4 +147,7 @@ def delta_ext(self, e, xb):
147147
digraph.couple(server, server.departure_port, observer, observer.departure_port)
148148

149149
simulator = devs.Simulator(digraph)
150-
simulator.execute_until(15.0)
150+
try:
151+
simulator.execute_until(15.0)
152+
except Exception as e:
153+
x = e

0 commit comments

Comments
 (0)