summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenAuth.OAuth2.ClientAuthorization/OAuth2/TokenEndpointProtocolException.cs
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2012-03-31 11:45:42 -0700
committerAndrew Arnott <andrewarnott@gmail.com>2012-03-31 11:45:42 -0700
commitaf226f837b7bb5050ab511e66ba75714f79d8865 (patch)
tree3dba68ac08d55fa46e2b5c0b52c96d6612b12a2a /src/DotNetOpenAuth.OAuth2.ClientAuthorization/OAuth2/TokenEndpointProtocolException.cs
parentb4aa4d4cf25f358e8ca199fe3fbd446d1bb9bc42 (diff)
parent7265452c16667c6ff499970b0d6778d5184cc8cb (diff)
downloadDotNetOpenAuth-af226f837b7bb5050ab511e66ba75714f79d8865.zip
DotNetOpenAuth-af226f837b7bb5050ab511e66ba75714f79d8865.tar.gz
DotNetOpenAuth-af226f837b7bb5050ab511e66ba75714f79d8865.tar.bz2
Applied some refactoring of OAuth2 classes.
Diffstat (limited to 'src/DotNetOpenAuth.OAuth2.ClientAuthorization/OAuth2/TokenEndpointProtocolException.cs')
-rw-r--r--src/DotNetOpenAuth.OAuth2.ClientAuthorization/OAuth2/TokenEndpointProtocolException.cs59
1 files changed, 59 insertions, 0 deletions
diff --git a/src/DotNetOpenAuth.OAuth2.ClientAuthorization/OAuth2/TokenEndpointProtocolException.cs b/src/DotNetOpenAuth.OAuth2.ClientAuthorization/OAuth2/TokenEndpointProtocolException.cs
new file mode 100644
index 0000000..308bfe2
--- /dev/null
+++ b/src/DotNetOpenAuth.OAuth2.ClientAuthorization/OAuth2/TokenEndpointProtocolException.cs
@@ -0,0 +1,59 @@
+//-----------------------------------------------------------------------
+// <copyright file="TokenEndpointProtocolException.cs" company="Andrew Arnott">
+// Copyright (c) Andrew Arnott. All rights reserved.
+// </copyright>
+//-----------------------------------------------------------------------
+
+namespace DotNetOpenAuth.OAuth2 {
+ using System;
+ using System.Collections.Generic;
+ using System.Globalization;
+ using System.Linq;
+ using System.Text;
+
+ using DotNetOpenAuth.Messaging;
+
+ /// <summary>
+ /// Describes an error generated by an Authorization Server's token endpoint.
+ /// </summary>
+ public class TokenEndpointProtocolException : ProtocolException {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="TokenEndpointProtocolException"/> class.
+ /// </summary>
+ /// <param name="error">A single error code from <see cref="Protocol.AccessTokenRequestErrorCodes"/>.</param>
+ /// <param name="description">A human-readable UTF-8 encoded text providing additional information, used to assist the client developer in understanding the error that occurred.</param>
+ /// <param name="moreInformation">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.</param>
+ 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;
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="TokenEndpointProtocolException"/> class.
+ /// </summary>
+ /// <param name="innerException">The inner exception.</param>
+ public TokenEndpointProtocolException(Exception innerException)
+ : base(Protocol.AccessTokenRequestErrorCodes.InvalidRequest, innerException) {
+ this.Error = Protocol.AccessTokenRequestErrorCodes.InvalidRequest;
+ }
+
+ /// <summary>
+ /// Gets a single error code from <see cref="Protocol.AccessTokenRequestErrorCodes"/>.
+ /// </summary>
+ public string Error { get; private set; }
+
+ /// <summary>
+ /// Gets a human-readable UTF-8 encoded text providing additional information, used to assist the client developer in understanding the error that occurred.
+ /// </summary>
+ public string Description { get; private set; }
+
+ /// <summary>
+ /// 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.
+ /// </summary>
+ public Uri MoreInformation { get; private set; }
+ }
+}