Skip to content

Commit bc8759f

Browse files
committed
fix(workflowstep): log exceptions
1 parent 1936c20 commit bc8759f

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

src/Flowrex.Core/DefaultCompensationStrategy.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@ public async Task CompensateAsync(
5252
logger.LogError(ex,
5353
"Compensation step {CompensationType} failed for step {StepType}. Continuing with remaining compensations",
5454
stepDef.CompensationStepType.Name, stepDef.StepType.Name);
55-
56-
// Compensation failures are logged but don't stop the compensation chain
5755
}
5856
}
5957

src/Flowrex.Core/WorkflowStep.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
using Flowrex.Abstractions;
22
using Flowrex.Results;
3+
using Microsoft.Extensions.Logging;
34

45
namespace Flowrex.Core;
56

67
/// <summary>
78
/// Abstract base class for workflow steps, providing common execution structure.
89
/// </summary>
9-
public abstract class WorkflowStep : IWorkflowStep
10+
public abstract class WorkflowStep(ILogger<WorkflowStep> logger) : IWorkflowStep
1011
{
1112
/// <summary>
1213
/// Executes the step logic within the given context.
@@ -27,6 +28,8 @@ public async Task<StepResult> ExecuteAsync(IWorkflowContext context, Cancellatio
2728
}
2829
catch (Exception ex)
2930
{
31+
// Add logging or error handling as needed.
32+
logger.LogError(ex, "Error occurred while executing step {StepName}", GetType().Name);
3033
// You could optionally add logging hooks here.
3134
return StepResult.Failure($"Exception in step {GetType().Name}: {ex.Message}");
3235
}

0 commit comments

Comments
 (0)