Refactor exceptions to include profileId context
Refactored `JobException` and derived classes (`InactiveProfileException`, `JobHttpException`, `JobSqlException`) to include `profileId` as a required parameter in their constructors. This ensures consistent context for exceptions related to job execution. Updated behaviors (`CheckQueryExecutionBehavior`, `MainQueryExecutionBehavior`, `ReCRequestExecutionBehavior`) to use the new constructors, passing `profileId` where applicable. Improved exception messages for better debugging context. Simplified property initialization and enhanced XML documentation for clarity.
This commit is contained in:
@@ -71,6 +71,7 @@ namespace ECMJobRunner.Application.Profiles.Commands.Behaviors
|
||||
{
|
||||
if (result is null)
|
||||
throw new JobSqlException(
|
||||
profileId: command.Job.ProfileId,
|
||||
jobName: "Triggering DEX",
|
||||
processName: "Main Query",
|
||||
batchId: command.BatchId,
|
||||
@@ -79,6 +80,7 @@ namespace ECMJobRunner.Application.Profiles.Commands.Behaviors
|
||||
innerException: null);
|
||||
else if (result.ReturnValue is not null)
|
||||
throw new JobSqlException(
|
||||
profileId: command.Job.ProfileId,
|
||||
jobName: "Triggering DEX",
|
||||
processName: "Main Query",
|
||||
batchId: command.BatchId,
|
||||
@@ -90,6 +92,7 @@ namespace ECMJobRunner.Application.Profiles.Commands.Behaviors
|
||||
{
|
||||
if (_options.Error.MainQuery.OnExecution == ErrorAction.Stop)
|
||||
throw new JobSqlException(
|
||||
profileId: command.Job.ProfileId,
|
||||
jobName: "Triggering DEX",
|
||||
processName: "Main Query",
|
||||
batchId: command.BatchId,
|
||||
@@ -101,6 +104,7 @@ namespace ECMJobRunner.Application.Profiles.Commands.Behaviors
|
||||
else if (_options.Error.MainQuery.IfNullOrWhiteSpace == ErrorAction.Stop)
|
||||
{
|
||||
throw new JobSqlException(
|
||||
profileId: command.Job.ProfileId,
|
||||
jobName: "Triggering DEX",
|
||||
processName: "Main Query",
|
||||
batchId: command.BatchId,
|
||||
|
||||
Reference in New Issue
Block a user