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.
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user