- Create InactiveProfileException for profile active status validation - Update TriggeringDEXJobBatchCommand to check profile active status before execution - Add ICfgProfileRepository dependency to batch command handler - Throw InactiveProfileException when attempting to execute inactive profiles - Add profile not found validation with descriptive error message - Reorganize commands under DEXJob/Commands directory structure
48 lines
1.8 KiB
C#
48 lines
1.8 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>
|
|
public class InactiveProfileException : JobException
|
|
{
|
|
/// <summary>
|
|
/// Initializes a new instance of InactiveProfileException
|
|
/// </summary>
|
|
/// <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 InactiveProfileException(long profileId, string? profileName, string batchId)
|
|
: base(
|
|
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))
|
|
{
|
|
ProfileId = profileId;
|
|
ProfileName = profileName;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Gets the ID of the inactive profile
|
|
/// </summary>
|
|
public long ProfileId { get; }
|
|
|
|
/// <summary>
|
|
/// Gets the name of the inactive profile (nullable)
|
|
/// </summary>
|
|
public string? ProfileName { get; }
|
|
}
|
|
}
|