log a thrown exception in an actor only when not handled (#303)
This commit is contained in:
Родитель
74ba231b61
Коммит
f872516d14
|
@ -1091,11 +1091,10 @@ namespace Microsoft.Coyote.Actors
|
|||
return false;
|
||||
}
|
||||
|
||||
this.Context.LogWriter.LogExceptionThrown(this.Id, this.CurrentStateName, methodName, ex);
|
||||
|
||||
OnExceptionOutcome outcome = this.OnException(ex, methodName, e);
|
||||
if (outcome is OnExceptionOutcome.ThrowException)
|
||||
{
|
||||
this.Context.LogWriter.LogExceptionThrown(this.Id, this.CurrentStateName, methodName, ex);
|
||||
return false;
|
||||
}
|
||||
else if (outcome is OnExceptionOutcome.Halt)
|
||||
|
@ -1116,11 +1115,10 @@ namespace Microsoft.Coyote.Actors
|
|||
/// should continue to get thrown.</returns>
|
||||
private protected bool OnUnhandledEventExceptionHandler(UnhandledEventException ex, Event e)
|
||||
{
|
||||
this.Context.LogWriter.LogExceptionThrown(this.Id, ex.CurrentStateName, string.Empty, ex);
|
||||
|
||||
OnExceptionOutcome outcome = this.OnException(ex, string.Empty, e);
|
||||
if (outcome is OnExceptionOutcome.ThrowException)
|
||||
{
|
||||
this.Context.LogWriter.LogExceptionThrown(this.Id, ex.CurrentStateName, string.Empty, ex);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1137,10 +1135,8 @@ namespace Microsoft.Coyote.Actors
|
|||
/// <param name="methodName">The handler (outermost) that threw the exception.</param>
|
||||
/// <param name="e">The event being handled when the exception was thrown.</param>
|
||||
/// <returns>The action that the runtime should take.</returns>
|
||||
protected virtual OnExceptionOutcome OnException(Exception ex, string methodName, Event e)
|
||||
{
|
||||
return OnExceptionOutcome.ThrowException;
|
||||
}
|
||||
protected virtual OnExceptionOutcome OnException(Exception ex, string methodName, Event e) =>
|
||||
OnExceptionOutcome.ThrowException;
|
||||
|
||||
/// <summary>
|
||||
/// Halts the actor.
|
||||
|
|
|
@ -176,7 +176,7 @@ namespace Microsoft.Coyote.Actors
|
|||
void OnPopStateUnhandledEvent(ActorId id, string stateName, Event e);
|
||||
|
||||
/// <summary>
|
||||
/// Invoked when the specified actor throws an exception.
|
||||
/// Invoked when the specified actor throws an exception without handling it.
|
||||
/// </summary>
|
||||
/// <param name="id">The id of the actor that threw the exception.</param>
|
||||
/// <param name="stateName">The state name, if the actor is a state machine and a state exists, else null.</param>
|
||||
|
@ -185,9 +185,9 @@ namespace Microsoft.Coyote.Actors
|
|||
void OnExceptionThrown(ActorId id, string stateName, string actionName, Exception ex);
|
||||
|
||||
/// <summary>
|
||||
/// Invoked when the specified OnException method is used to handle a thrown exception.
|
||||
/// Invoked when the specified actor has handled a thrown exception.
|
||||
/// </summary>
|
||||
/// <param name="id">The id of the actor that threw the exception.</param>
|
||||
/// <param name="id">The id of the actor that handled the exception.</param>
|
||||
/// <param name="stateName">The state name, if the actor is a state machine and a state exists, else null.</param>
|
||||
/// <param name="actionName">The name of the action being executed.</param>
|
||||
/// <param name="ex">The exception.</param>
|
||||
|
|
|
@ -399,7 +399,7 @@ namespace Microsoft.Coyote.Actors
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Logs that the specified actor throws an exception.
|
||||
/// Logs that the specified actor throws an exception without handling it.
|
||||
/// </summary>
|
||||
/// <param name="id">The id of the actor that threw the exception.</param>
|
||||
/// <param name="stateName">The state name, if the actor is a state machine and a state exists, else null.</param>
|
||||
|
@ -417,9 +417,9 @@ namespace Microsoft.Coyote.Actors
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Logs that the specified OnException method is used to handle a thrown exception.
|
||||
/// Logs that the specified actor has handled a thrown exception.
|
||||
/// </summary>
|
||||
/// <param name="id">The id of the actor that threw the exception.</param>
|
||||
/// <param name="id">The id of the actor that handled the exception.</param>
|
||||
/// <param name="stateName">The state name, if the actor is a state machine and a state exists, else null.</param>
|
||||
/// <param name="actionName">The name of the action being executed.</param>
|
||||
/// <param name="ex">The exception.</param>
|
||||
|
|
Загрузка…
Ссылка в новой задаче