using System; #if FEATURE_BINARY_SERIALIZATION using System.Runtime.Serialization; #endif // FEATURE_BINARY_SERIALIZATION using Renci.SshNet.Messages.Transport; namespace Renci.SshNet.Common { /// /// The exception that is thrown when connection was terminated. /// #if FEATURE_BINARY_SERIALIZATION [Serializable] #endif // FEATURE_BINARY_SERIALIZATION public class SshConnectionException : SshException { /// /// Gets the disconnect reason if provided by the server or client. Otherwise None. /// public DisconnectReason DisconnectReason { get; private set; } /// /// Initializes a new instance of the class. /// public SshConnectionException() { } /// /// Initializes a new instance of the class. /// /// The message. public SshConnectionException(string message) : base(message) { DisconnectReason = DisconnectReason.None; } /// /// Initializes a new instance of the class. /// /// The message. /// The disconnect reason code. public SshConnectionException(string message, DisconnectReason disconnectReasonCode) : base(message) { DisconnectReason = disconnectReasonCode; } /// /// Initializes a new instance of the class. /// /// The message. /// The disconnect reason code. /// The inner. public SshConnectionException(string message, DisconnectReason disconnectReasonCode, Exception inner) : base(message, inner) { DisconnectReason = disconnectReasonCode; } #if FEATURE_BINARY_SERIALIZATION /// /// Initializes a new instance of the class. /// /// The that holds the serialized object data about the exception being thrown. /// The that contains contextual information about the source or destination. /// The parameter is null. /// The class name is null or is zero (0). protected SshConnectionException(SerializationInfo info, StreamingContext context) : base(info, context) { } #endif // FEATURE_BINARY_SERIALIZATION } }