/// <summary> /// Initializes a new instance of the <see cref="MailKit.Security.SaslException"/> class. /// </summary> /// <remarks> /// Creates a new <see cref="SaslException"/>. /// </remarks> /// <param name="mechanism">The SASL mechanism.</param> /// <param name="code">The error code.</param> /// <param name="message">The error message.</param> /// <exception cref="System.ArgumentNullException"> /// <paramref name="mechanism"/> is <c>null</c>. /// </exception> public SaslException(string mechanism, SaslErrorCode code, string message) : base(message) { if (mechanism == null) { throw new ArgumentNullException(nameof(mechanism)); } Mechanism = mechanism; ErrorCode = code; }
static void AssertSaslException (SaslMechanismScramSha1 sasl, string challenge, SaslErrorCode code) { var token = Encoding.ASCII.GetBytes (challenge); try { sasl.Challenge (Convert.ToBase64String (token)); } catch (SaslException sex) { Assert.AreEqual (code, sex.ErrorCode, "ErrorCode"); return; } catch (Exception ex) { Assert.Fail ("SaslException expected, but got: {0}", ex.GetType ().Name); return; } Assert.Fail ("SaslException expected."); }
/// <summary> /// Initializes a new instance of the <see cref="MailKit.Security.SaslException"/> class. /// </summary> /// <param name="mechanism">The SASL mechanism.</param> /// <param name="code">The error code.</param> /// <param name="message">The error message.</param> internal SaslException(string mechanism, SaslErrorCode code, string message) : base(message) { Mechanism = mechanism; ErrorCode = code; }
/// <summary> /// Initializes a new instance of the <see cref="MailKit.Security.SaslException"/> class. /// </summary> /// <remarks> /// Creates a new <see cref="SaslException"/>. /// </remarks> /// <param name="mechanism">The SASL mechanism.</param> /// <param name="code">The error code.</param> /// <param name="message">The error message.</param> /// <exception cref="System.ArgumentNullException"> /// <paramref name="mechanism"/> is <c>null</c>. /// </exception> public SaslException (string mechanism, SaslErrorCode code, string message) : base (message) { if (mechanism == null) throw new ArgumentNullException (nameof (mechanism)); Mechanism = mechanism; ErrorCode = code; }