dc7fd16dd5
CLI-40: port the exact-secret credential scrub to Rust/Java/.NET (Go/Python
already did it). AuthenticateUser/WriteSecured(2) helpers now redact the exact
caller-supplied secret from any surfaced error, as defense-in-depth on top of the
by-construction guarantee. Rust hand-writes a redacting Debug (derived Debug would
leak the reply); Java/.NET rebuild the same exception type with the redacted
message and do not carry the secret-bearing original forward (so ToString/stack
traces stay clean too).
CLI-41: uniform malformed-reply contract for AuthenticateUser/ArchestrAUserToId/
AddBufferedItem across all five clients — typed payload, else a present int32
return_value, else a typed malformed-reply error. Fixes Go/Java silent-0, .NET
NRE, and Rust's own internal inconsistency.
CLI-44: the Go event goroutine's Recv-error path now uses a non-blocking
sendTerminalEventResult on the reserved slot, so a genuine terminal stream error
is reported as itself instead of being mislabeled ErrSlowConsumer under overflow.
Riders from the CLI-37/38 review: (a) .NET ToDiagnosticSummary and Python
_mxaccess_message surface the raw success member (diagnostics-only parity with
Rust); (b) the status-conversion fixture carries an independent wantSuccess
boolean and the Go/.NET fixture tests assert against it instead of recomputing
the formula under test.
Shared fixtures (authenticate-user.{echoed-credential,missing-payload,
return-value-only}.reply.json) + manifest + ClientBehaviorFixtures.md +
ClientLibrariesDesign.md updated in the same change. Tracking: CLI-40/41/44 -> Done.
47 lines
1.9 KiB
C#
47 lines
1.9 KiB
C#
using ZB.MOM.WW.MxGateway.Contracts.Proto;
|
|
|
|
namespace ZB.MOM.WW.MxGateway.Client;
|
|
|
|
/// <summary>
|
|
/// Exception thrown when the gateway returns a protocol-OK reply that carries neither the
|
|
/// expected typed payload nor an int32 <c>return_value</c>, so the client cannot resolve the
|
|
/// operation result. This replaces the historical <see cref="NullReferenceException"/> that a
|
|
/// blind <c>reply.ReturnValue.Int32Value</c> fallback would throw.
|
|
/// </summary>
|
|
public sealed class MxGatewayMalformedReplyException : MxGatewayException
|
|
{
|
|
/// <summary>Initializes a new instance with the given message.</summary>
|
|
/// <param name="message">The error message describing the malformed reply.</param>
|
|
public MxGatewayMalformedReplyException(string message)
|
|
: base(message)
|
|
{
|
|
}
|
|
|
|
/// <summary>Initializes a new instance with full diagnostic context.</summary>
|
|
/// <param name="message">The error message describing the malformed reply.</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>
|
|
public MxGatewayMalformedReplyException(
|
|
string message,
|
|
string? sessionId = null,
|
|
string? correlationId = null,
|
|
ProtocolStatus? protocolStatus = null,
|
|
int? hResult = null,
|
|
IReadOnlyList<MxStatusProxy>? statuses = null,
|
|
Exception? innerException = null)
|
|
: base(
|
|
message,
|
|
sessionId,
|
|
correlationId,
|
|
protocolStatus,
|
|
hResult,
|
|
statuses ?? [],
|
|
innerException)
|
|
{
|
|
}
|
|
}
|