namespace ZB.MOM.WW.OtOpcUa.Driver.FOCAS.Wire; /// /// Thrown by the wire client when a FOCAS request fails — either at the protocol layer /// (invalid PDU magic, desynchronised response framing, connection dropped mid-request) /// or when the CNC returns a non-zero EW_* return code. /// /// /// Callers distinguish the two classes via : true /// when the transport is gone (socket closed, timeout, cancellation mid-write) and the /// wire client has already torn the sockets down, so a reconnect is required before any /// further call. false for protocol-level errors where the connection is still /// usable. /// carries the wire-level FOCAS return code when the exception /// came from a parsed response block. Null when the failure happened before a response /// was received (e.g. connect-time handshake errors). /// public class FocasWireException : Exception { /// FOCAS EW_* return code from the response block, when available. public short? Rc { get; } /// /// True when the transport was closed as a side effect of this failure — the caller /// must reconnect before issuing the next request. /// public bool IsTransient { get; } public FocasWireException(string message) : base(message) { } public FocasWireException(string message, short? rc, bool isTransient = false) : base(message) { Rc = rc; IsTransient = isTransient; } public FocasWireException(string message, Exception innerException) : base(message, innerException) { } public FocasWireException(string message, Exception innerException, bool isTransient) : base(message, innerException) { IsTransient = isTransient; } }