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.
37 lines
1.5 KiB
C#
37 lines
1.5 KiB
C#
using System;
|
|
|
|
namespace ECMJobRunner.Application.Common.Exceptions
|
|
{
|
|
/// <summary>
|
|
/// Exception thrown when attempting to execute a job for an inactive profile
|
|
/// Extends JobException with profile-specific context
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Initializes a new instance of InactiveProfileException
|
|
/// </remarks>
|
|
/// <param name="profileId">ID of the inactive profile</param>
|
|
/// <param name="profileName">Name of the inactive profile (nullable)</param>
|
|
/// <param name="batchId">Unique batch identifier for tracking</param>
|
|
/// <remarks>
|
|
/// Use this exception when:
|
|
/// - Attempting to trigger DEX job batch for an inactive profile
|
|
/// - Attempting to execute individual jobs from an inactive profile
|
|
/// - Profile is deactivated during execution
|
|
/// </remarks>
|
|
public class InactiveProfileException(long profileId, string? profileName, string batchId) : JobException(
|
|
profileId,
|
|
jobName: "Profile Execution",
|
|
processName: "Profile Active Status Validation",
|
|
batchId: batchId,
|
|
reason: "The profile is marked as inactive and cannot be executed",
|
|
innerException: null,
|
|
("Profile ID", profileId.ToString(), false),
|
|
("Profile Name", profileName, true))
|
|
{
|
|
/// <summary>
|
|
/// Gets the name of the inactive profile (nullable)
|
|
/// </summary>
|
|
public string? ProfileName { get; } = profileName;
|
|
}
|
|
}
|