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:
@@ -78,13 +78,13 @@ namespace ECMJobRunner.Application.Profiles.Commands.Behaviors
|
|||||||
reason: "Main Query returned nothing.",
|
reason: "Main Query returned nothing.",
|
||||||
query: sqlMainQuery,
|
query: sqlMainQuery,
|
||||||
innerException: null);
|
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(
|
throw new JobSqlException(
|
||||||
profileId: command.Job.ProfileId,
|
profileId: command.Job.ProfileId,
|
||||||
jobName: "Triggering DEX",
|
jobName: "Triggering DEX",
|
||||||
processName: "Main Query",
|
processName: "Main Query",
|
||||||
batchId: command.BatchId,
|
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);
|
query: sqlMainQuery, innerException: null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user