Add logging for unexpected BodyQuery and IsReturnedNoData

Improve observability by adding a warning log when `request.BodyQuery` is not null but `request.IsReturnedNoData.BodyQuery` is false.

The log message highlights potential issues, such as skipped `BodyQueryBehavior` execution or missing control steps, and includes `ProfileId` and `ActionId` for better debugging context.
This commit is contained in:
Developer 02 2025-11-29 01:12:03 +01:00
parent e0736ff6df
commit 07afcf3aa2

View File

@ -45,6 +45,17 @@ public class InvokeRecActionCommandHandler(
using var reqBody = new StringContent(request.Body);
httpReq.Content = reqBody;
}
else if(request.BodyQuery is not null && !request.IsReturnedNoData.BodyQuery)
{
logger?.LogWarning(
"Although BodyQuery returns null, the IsReturnedNoData variable has not been set to TRUE. " +
"This indicates that BodyQueryBehavior has not been executed or that the relevant control step has been skipped. " +
"The relevant behavior must be verified to ensure that the process does not produce unexpected conditions. " +
"ProfileId: {ProfileId}, ActionId: {ActionId}",
request.ProfileId,
request.ActionId
);
}
using var response = await http.SendAsync(httpReq, cancel);
var body = await response.Content.ReadAsStringAsync(cancel);