using System; namespace ZB.MOM.WW.MxGateway.Worker.MxAccess; /// /// Captures details about an MXAccess operation that failed during shutdown. /// public sealed class MxAccessShutdownFailure { /// /// Initializes the shutdown failure record. /// /// Name of the operation that failed. /// Server handle if applicable. /// Item handle if applicable. /// Exception that was raised. public MxAccessShutdownFailure( string operation, int? serverHandle, int? itemHandle, Exception exception) { if (string.IsNullOrWhiteSpace(operation)) { throw new ArgumentException("Shutdown failure operation is required.", nameof(operation)); } Operation = operation; ServerHandle = serverHandle; ItemHandle = itemHandle; ExceptionType = exception?.GetType().FullName ?? string.Empty; HResult = exception?.HResult; } /// /// The operation that failed (e.g., Unregister, RemoveItem). /// public string Operation { get; } /// /// Server handle if applicable; otherwise null. /// public int? ServerHandle { get; } /// /// Item handle if applicable; otherwise null. /// public int? ItemHandle { get; } /// /// Full type name of the exception, or empty string if no exception. /// public string ExceptionType { get; } /// /// HResult code if the exception has one; otherwise null. /// public int? HResult { get; } }