Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed on error suppress behavior; Fixed nested pipelines error handling #60

Merged
merged 3 commits into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Changed on error suppress behavior
  • Loading branch information
mvSapphire committed Jul 3, 2024
commit 4df2e2af175b1c9e72750024f5f9cfb6dd5adf24
9 changes: 8 additions & 1 deletion src/PowerPipe/Builder/Steps/InternalStep.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,15 @@ public async ValueTask ExecuteAsync(TContext context, CancellationToken cancella

ErrorHandledSucceed = await HandleExceptionAsync(context, cancellationToken);

if (!ErrorHandledSucceed.Value)
if (ErrorHandledSucceed.Value)
{
if (NextStep is not null)
await NextStep.ExecuteAsync(context, cancellationToken);
}
else
{
throw new PipelineExecutionException(e);
}
}
finally
{
Expand Down
8 changes: 5 additions & 3 deletions src/PowerPipe/Builder/Steps/LazyStep.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ internal LazyStep(Func<IStepBase<TContext>> factory, ILoggerFactory loggerFactor
if (instance is IPipelineStep<TContext> step)
step.NextStep = NextStep;

Logger = loggerFactory?.CreateLogger(instance.GetType());
var instanceType = instance.GetType();

Logger = loggerFactory?.CreateLogger(instanceType);

Logger?.LogDebug("{Step} executing", instanceType.FullName);

return instance;
});
Expand All @@ -45,7 +49,5 @@ protected override async ValueTask ExecuteInternalAsync(TContext context, Cancel
StepExecuted = true;

await _step.Value.ExecuteAsync(context, cancellationToken);

Logger?.LogDebug("{Step} executed", _step.Value.GetType().FullName);
}
}
Loading