From d7c8607fbf745b13123773409788fca91c4a171c Mon Sep 17 00:00:00 2001 From: TekH Date: Wed, 5 Aug 2026 09:27:48 +0200 Subject: [PATCH] Fix conditional logic and update exception message Updated the `else if` condition to use a logical AND (`&&`) instead of a logical OR (`||`) to ensure the condition checks if `result.ReturnValue` is both not null and not equal to 0. Aligned the exception message with the updated logic to indicate that the expected value is "null or 0" instead of just "null." This change improves correctness and prevents unintended behavior. --- .../Profiles/Commands/Behaviors/MainQueryExecutionBehavior.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ECMJobRunner.Application/Profiles/Commands/Behaviors/MainQueryExecutionBehavior.cs b/ECMJobRunner.Application/Profiles/Commands/Behaviors/MainQueryExecutionBehavior.cs index d7644f1..3570657 100644 --- a/ECMJobRunner.Application/Profiles/Commands/Behaviors/MainQueryExecutionBehavior.cs +++ b/ECMJobRunner.Application/Profiles/Commands/Behaviors/MainQueryExecutionBehavior.cs @@ -78,13 +78,13 @@ namespace ECMJobRunner.Application.Profiles.Commands.Behaviors reason: "Main Query returned nothing.", query: sqlMainQuery, innerException: null); - else if (result.ReturnValue is not null || result.ReturnValue != 0) + else if (result.ReturnValue is not null && result.ReturnValue != 0) throw new JobSqlException( profileId: command.Job.ProfileId, jobName: "Triggering DEX", processName: "Main Query", batchId: command.BatchId, - reason: $"The query unexpectedly returned the value {result.ReturnValue}. The expected value was null.", + reason: $"The query unexpectedly returned the value {result.ReturnValue}. The expected value was null or 0.", query: sqlMainQuery, innerException: null); } }