namespace ZB.MOM.WW.MxGateway.Server.Workers;

public sealed class WorkerProcessLaunchException : Exception
{
    /// <summary>Initializes a new instance of the <see cref="WorkerProcessLaunchException"/> class.</summary>
    /// <param name="errorCode">Error code for the worker process launch failure.</param>
    /// <param name="message">Diagnostic message.</param>
    public WorkerProcessLaunchException(
        WorkerProcessLaunchErrorCode errorCode,
        string message)
        : base(message)
    {
        ErrorCode = errorCode;
    }

    /// <summary>Initializes a new instance of the <see cref="WorkerProcessLaunchException"/> class with an inner exception.</summary>
    /// <param name="errorCode">Error code for the worker process launch failure.</param>
    /// <param name="message">Diagnostic message.</param>
    /// <param name="innerException">Underlying exception.</param>
    public WorkerProcessLaunchException(
        WorkerProcessLaunchErrorCode errorCode,
        string message,
        Exception innerException)
        : base(message, innerException)
    {
        ErrorCode = errorCode;
    }

    /// <summary>Gets the error code for the worker process launch failure.</summary>
    public WorkerProcessLaunchErrorCode ErrorCode { get; }
}
