From a14d5ff1125335fcae4c6f24c9994091c24de0e8 Mon Sep 17 00:00:00 2001 From: TekH Date: Wed, 25 Mar 2026 09:57:46 +0100 Subject: [PATCH] Improve error handling with RecActionException Wrap exceptions in PreprocessingBehavior with RecActionException, including ActionId and ProfileId for better context and debugging. This enhances error reporting when ErrorAction is set to Stop. --- .../Common/Behaviors/Action/PreprocessingBehavior.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ReC.Application/Common/Behaviors/Action/PreprocessingBehavior.cs b/src/ReC.Application/Common/Behaviors/Action/PreprocessingBehavior.cs index 9a3009b..ba33bda 100644 --- a/src/ReC.Application/Common/Behaviors/Action/PreprocessingBehavior.cs +++ b/src/ReC.Application/Common/Behaviors/Action/PreprocessingBehavior.cs @@ -1,4 +1,5 @@ using MediatR; +using ReC.Application.Common.Exceptions; using ReC.Application.Common.Interfaces; using ReC.Application.RecActions.Commands; using ReC.Application.Results.Commands; @@ -33,7 +34,7 @@ public class PreprocessingBehavior(IRecDbContext context, ISender sender) : IPip }, cancel); if (request.Action.ErrorAction == ErrorAction.Stop) - throw; + throw new RecActionException(request.Action.Id, request.Action.ProfileId, ex); } return await next(cancel);