//-----------------------------------------------------------------------
//
// Copyright (c) Andrew Arnott. All rights reserved.
//
//-----------------------------------------------------------------------
namespace DotNetOpenAuth.OAuth2 {
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using DotNetOpenAuth.Messaging;
///
/// Describes an error generated by an Authorization Server's token endpoint.
///
public class TokenEndpointProtocolException : ProtocolException {
///
/// Initializes a new instance of the class.
///
/// A single error code from .
/// A human-readable UTF-8 encoded text providing additional information, used to assist the client developer in understanding the error that occurred.
/// A URI identifying a human-readable web page with information about the error, used to provide the client developer with additional information about the error.
public TokenEndpointProtocolException(string error, string description = null, Uri moreInformation = null)
: base(string.Format(CultureInfo.CurrentCulture, ClientAuthorizationStrings.TokenEndpointErrorFormat, error, description)) {
Requires.NotNullOrEmpty(error, "error");
this.Error = error;
this.Description = description;
this.MoreInformation = moreInformation;
}
///
/// Initializes a new instance of the class.
///
/// The inner exception.
public TokenEndpointProtocolException(Exception innerException)
: base(Protocol.AccessTokenRequestErrorCodes.InvalidRequest, innerException) {
this.Error = Protocol.AccessTokenRequestErrorCodes.InvalidRequest;
}
///
/// Gets a single error code from .
///
public string Error { get; private set; }
///
/// Gets a human-readable UTF-8 encoded text providing additional information, used to assist the client developer in understanding the error that occurred.
///
public string Description { get; private set; }
///
/// Gets a URI identifying a human-readable web page with information about the error, used to provide the client developer with additional information about the error.
///
public Uri MoreInformation { get; private set; }
}
}