using System; using System.Diagnostics.CodeAnalysis; using System.Net; using System.Runtime.Serialization; namespace Octokit { #if !NETFX_CORE /// /// Represents a failed 2FA challenge from the API /// [Serializable] #endif [SuppressMessage("Microsoft.Design", "CA1032:ImplementStandardExceptionConstructors", Justification = "These exceptions are specific to the GitHub API and not general purpose exceptions")] public class TwoFactorChallengeFailedException : AuthorizationException { /// /// Constructs an instance of TwoFactorChallengeFailedException /// public TwoFactorChallengeFailedException() : base(HttpStatusCode.Unauthorized, null) { } /// /// Constructs an instance of TwoFactorChallengeFailedException /// /// The inner exception public TwoFactorChallengeFailedException(Exception innerException) : base(HttpStatusCode.Unauthorized, innerException) { } public override string Message { get { return "The two-factor authentication code supplied is not correct"; } } #if !NETFX_CORE /// /// Constructs an instance of TwoFactorChallengeFailedException /// /// /// The that holds the /// serialized object data about the exception being thrown. /// /// /// The that contains /// contextual information about the source or destination. /// protected TwoFactorChallengeFailedException(SerializationInfo info, StreamingContext context) : base(info, context) { } #endif } }