using MxGateway.Contracts.Proto;
namespace MxGateway.Client;
/// Exception thrown when an MXAccess command fails with a non-zero HResult or failing status.
public sealed class MxAccessException : MxGatewayCommandException
{
/// Initializes a new instance with the given message, reply, and optional inner exception.
/// The error message describing the MXAccess failure.
/// The MxCommandReply containing the failure details (statuses, HResult, etc.).
/// The underlying exception, if any.
public MxAccessException(
string message,
MxCommandReply reply,
Exception? innerException = null)
: base(
message,
reply.SessionId,
reply.CorrelationId,
reply.ProtocolStatus,
reply.HasHresult ? reply.Hresult : null,
reply.Statuses.ToArray(),
innerException)
{
Reply = reply;
}
/// Gets the underlying MxCommandReply containing full failure details.
public MxCommandReply Reply { get; }
}