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.
This commit is contained in:
2026-08-05 09:27:48 +02:00
parent 8d4c08fbec
commit d7c8607fbf

View File

@@ -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);
}
}