Skip to content

Commit

Permalink
Small check
Browse files Browse the repository at this point in the history
  • Loading branch information
mikolaj-milewski committed Oct 31, 2024
1 parent 49b3775 commit 756a8ed
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Stateflows.Common;
using Stateflows.Common.Context;
using Stateflows.StateMachines.Context.Interfaces;

namespace Stateflows.StateMachines.Inspection.Interfaces
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
using System.Threading.Tasks;
using System;
using System.Threading.Tasks;
using Stateflows.Common;
using Stateflows.StateMachines;
using Stateflows.StateMachines.Context.Interfaces;
using Stateflows.StateMachines.Inspection.Interfaces;
using Stateflows.Extensions.PlantUml.Events;
using System.Diagnostics;

namespace Stateflows.Extensions.PlantUml.Classes
{
Expand All @@ -14,17 +16,27 @@ public Task AfterHydrateAsync(IStateMachineActionContext context)

public Task AfterProcessEventAsync(IEventActionContext<Event> context)
{
if (
context is IEventInspectionContext<Event> inspectionContext &&
inspectionContext.StateMachine.Inspection.StateHasChanged
)
try
{
context.StateMachine.Publish(
new PlantUmlNotification()
{
PlantUml = inspectionContext.StateMachine.Inspection.GetPlantUml()
}
);
if (context is IEventInspectionContext<Event> inspectionContext &&
inspectionContext.StateMachine.Inspection.StateHasChanged
)
{
context.StateMachine.Publish(
new PlantUmlNotification()
{
PlantUml = inspectionContext.StateMachine.Inspection.GetPlantUml()
}
);
}
}
catch (Exception e)
{
Trace.WriteLine($"⦗→s⦘ PlantUML exception '{e.GetType().Name}' thrown with message '{e.Message}'; stack trace:");
foreach (var line in e.StackTrace.Split('\n'))
{
Trace.WriteLine($"⦗→s⦘ {line}");
}
}

return Task.CompletedTask;
Expand Down

0 comments on commit 756a8ed

Please sign in to comment.