diff --git a/src/ReC.Application/Common/Behaviors/BodyQueryBehavior.cs b/src/ReC.Application/Common/Behaviors/BodyQueryBehavior.cs index 3c533fc..fa77ffb 100644 --- a/src/ReC.Application/Common/Behaviors/BodyQueryBehavior.cs +++ b/src/ReC.Application/Common/Behaviors/BodyQueryBehavior.cs @@ -9,14 +9,16 @@ public class BodyQueryBehavior(IRecDbContext dbContext) : IPipelineB where TRecAction : RecActionDto { public async Task Handle(TRecAction action, RequestHandlerDelegate next, CancellationToken cancel) - { + { if (action.BodyQuery is null) return await next(cancel); var result = await dbContext.BodyQueryResults.FromSqlRaw(action.BodyQuery).FirstOrDefaultAsync(cancel); - if (result is null || result.RawBody is null) - throw new InvalidOperationException("Body query did not return a result or returned a null REQUEST_BODY."); + if (result?.RawBody is null) + throw new InvalidOperationException( + $"Body query did not return a result or returned a null REQUEST_BODY. " + + $"ProfileId: {action.ProfileId}, ActionId: {action.ActionId}."); action.Body = result.RawBody;