From e0736ff6dfff4420b7addfaeb30f5fd12e8971f1 Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Sat, 29 Nov 2025 00:55:43 +0100 Subject: [PATCH] Improve HeaderQueryBehavior error handling and logging Updated HeaderQueryBehavior to handle null or missing REQUEST_HEADER gracefully by logging warnings and setting action.IsReturnedNoData.HeaderQuery to true instead of throwing exceptions. Enhanced log messages for failed RawHeader deserialization to improve clarity and added pipeline continuity by calling await next(cancel). Refactored log formatting for consistency. --- .../Common/Behaviors/HeaderQueryBehavior.cs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/ReC.Application/Common/Behaviors/HeaderQueryBehavior.cs b/src/ReC.Application/Common/Behaviors/HeaderQueryBehavior.cs index 4b66322..a331340 100644 --- a/src/ReC.Application/Common/Behaviors/HeaderQueryBehavior.cs +++ b/src/ReC.Application/Common/Behaviors/HeaderQueryBehavior.cs @@ -18,15 +18,24 @@ public class HeaderQueryBehavior(IRecDbContext dbContext, ILogger>(result.RawHeader); if(headerDict is null) { - logger?.LogWarning("Failed to deserialize header query result: {RawHeader}. Profile ID: {ProfileId}, Action ID: {ActionId}", result.RawHeader, action.ProfileId, action.ActionId); + logger?.LogWarning( + "Header JSON deserialization returned null. RawHeader: {RawHeader}, ProfileId: {ProfileId}, ActionId: {ActionId}", + result.RawHeader, action.ProfileId, action.ActionId); + + action.IsReturnedNoData.HeaderQuery = true; + return await next(cancel); }