Throw exception for null RawHeader in HeaderQueryBehavior
Previously, the code continued execution when the RawHeader property of the query result was null. This change introduces an InvalidOperationException to handle this case, ensuring that the absence of a valid RawHeader is treated as an error. The exception message includes ProfileId and ActionId for better debugging context.
This commit is contained in:
parent
cc787f445a
commit
ff53be5d13
@ -18,7 +18,9 @@ public class HeaderQueryBehavior<TRecAction>(IRecDbContext dbContext, ILogger<He
|
||||
var result = await dbContext.HeaderQueryResults.FromSqlRaw(action.HeaderQuery).FirstOrDefaultAsync(cancel);
|
||||
|
||||
if(result?.RawHeader is null)
|
||||
return await next(cancel);
|
||||
throw new InvalidOperationException(
|
||||
$"Header query did not return a result or returned a null REQUEST_HEADER. " +
|
||||
$"ProfileId: {action.ProfileId}, ActionId: {action.ActionId}.");
|
||||
|
||||
var headerDict = JsonSerializer.Deserialize<Dictionary<string, JsonElement>>(result.RawHeader);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user