As it is currently implemented, whenever there is an Exception thrown via Simulator.throwException, the Simulator.run function will always throw the first exception and halt any remaining progress through the run function. It also will always log a severe message. Some implications:
Only the first exception is made visible to the user
Even if a user catches the exception, there is still a severe message which could cause test failures in ROHD-VF testbenches
No end-of-simulation actions will ever execute
These seem like excessive limitations, and we should provide a method of gracefully handling issues from the Simulator.
=====
Additionally, if the Simulator is not actively running, then Simulator.throwException currently does nothing. This doesn't seem like proper behavior, and we should probably be immediately rethrowing in this case.
Desired solution
A way to configure the Simulator to gracefully handle error before defaulting to throwing it and incurring all of the downsides mentioned above. We can maybe look to the event handlers of StreamSubscription for inspiration: https://api.flutter.dev/flutter/dart-async/StreamSubscription-class.html
It should be possible to handle errors and still execute end-of-simulation actions.
Some thought needs to be put into how to log the messages in a way that is convenient for use cases like ROHD-VF.
======
We should immediately rethrow exceptions passed to Simulator.throwException if the simulation is not running.
Additionally, if anything catches the Simulator's exceptions, the Simulation.simulationEnded never completes, which also means that any Simulator.reset() will never complete!
Motivation
As it is currently implemented, whenever there is an
Exception
thrown viaSimulator.throwException
, theSimulator.run
function will always throw the first exception and halt any remaining progress through the run function. It also will always log asevere
message. Some implications:severe
message which could cause test failures in ROHD-VF testbenchesThese seem like excessive limitations, and we should provide a method of gracefully handling issues from the
Simulator
.=====
Additionally, if the
Simulator
is not actively running, thenSimulator.throwException
currently does nothing. This doesn't seem like proper behavior, and we should probably be immediately rethrowing in this case.Desired solution
A way to configure the
Simulator
to gracefully handle error before defaulting tothrow
ing it and incurring all of the downsides mentioned above. We can maybe look to the event handlers ofStreamSubscription
for inspiration: https://api.flutter.dev/flutter/dart-async/StreamSubscription-class.htmlIt should be possible to handle errors and still execute end-of-simulation actions.
Some thought needs to be put into how to log the messages in a way that is convenient for use cases like ROHD-VF.
======
We should immediately rethrow exceptions passed to
Simulator.throwException
if the simulation is not running.Alternatives considered
No response
Additional details
No response