8023eccfa6
Client.Dotnet-001: MapRpcException typed only Unauthenticated and PermissionDenied; every other gRPC status collapsed to an untyped exception with the status code discarded. Added a nullable StatusCode to MxGatewayException, extracted the duplicated mappers into a shared RpcExceptionMapper that records the code for every status, and documented it. Client.Dotnet-002: the production retry branch (MxGatewayException wrapping RpcException) was never exercised. FakeGatewayTransport gained a MapTransportExceptions mode that runs thrown RpcExceptions through RpcExceptionMapper exactly as the production transport does. Client.Dotnet-003: MxGatewaySession.DisposeAsync disposed _closeLock while a concurrent CloseAsync could be parked in WaitAsync. DisposeAsync now drains in-flight CloseAsync callers before disposing the semaphore; the client's _disposed flag is accessed via Interlocked. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
39 lines
1.5 KiB
C#
39 lines
1.5 KiB
C#
using Grpc.Core;
|
|
using MxGateway.Contracts.Proto;
|
|
|
|
namespace MxGateway.Client;
|
|
|
|
/// <summary>Exception thrown when an API key is invalid, expired, or malformed.</summary>
|
|
public sealed class MxGatewayAuthenticationException : MxGatewayException
|
|
{
|
|
/// <summary>Initializes a new instance with the given details.</summary>
|
|
/// <param name="message">The error message describing the authentication failure.</param>
|
|
/// <param name="sessionId">The session ID, if available.</param>
|
|
/// <param name="correlationId">The correlation ID for tracing, if available.</param>
|
|
/// <param name="protocolStatus">The protocol status details, if available.</param>
|
|
/// <param name="hResult">The HResult code, if available.</param>
|
|
/// <param name="statuses">The MXAccess statuses, if available.</param>
|
|
/// <param name="innerException">The underlying exception, if any.</param>
|
|
/// <param name="statusCode">The gRPC status code reported by the failed call, if available.</param>
|
|
public MxGatewayAuthenticationException(
|
|
string message,
|
|
string? sessionId = null,
|
|
string? correlationId = null,
|
|
ProtocolStatus? protocolStatus = null,
|
|
int? hResult = null,
|
|
IReadOnlyList<MxStatusProxy>? statuses = null,
|
|
Exception? innerException = null,
|
|
StatusCode? statusCode = null)
|
|
: base(
|
|
message,
|
|
sessionId,
|
|
correlationId,
|
|
protocolStatus,
|
|
hResult,
|
|
statuses ?? [],
|
|
innerException,
|
|
statusCode)
|
|
{
|
|
}
|
|
}
|