summaryrefslogtreecommitdiffstats
path: root/src/DotNetOAuth/Messaging/ProtocolException.cs
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2008-09-13 09:55:52 -0700
committerAndrew <andrewarnott@gmail.com>2008-09-13 09:55:52 -0700
commit61650a6ec207c94cb92e27227dac75606c3e7e00 (patch)
tree94211306924328968711f101bc1234a417fc62ea /src/DotNetOAuth/Messaging/ProtocolException.cs
parentae2258f38effe0eca177d3610a9a113288f6365b (diff)
downloadDotNetOpenAuth-61650a6ec207c94cb92e27227dac75606c3e7e00.zip
DotNetOpenAuth-61650a6ec207c94cb92e27227dac75606c3e7e00.tar.gz
DotNetOpenAuth-61650a6ec207c94cb92e27227dac75606c3e7e00.tar.bz2
Added a few ProtocolException-derived exception types.
Diffstat (limited to 'src/DotNetOAuth/Messaging/ProtocolException.cs')
-rw-r--r--src/DotNetOAuth/Messaging/ProtocolException.cs29
1 files changed, 28 insertions, 1 deletions
diff --git a/src/DotNetOAuth/Messaging/ProtocolException.cs b/src/DotNetOAuth/Messaging/ProtocolException.cs
index 6101073..d7c3675 100644
--- a/src/DotNetOAuth/Messaging/ProtocolException.cs
+++ b/src/DotNetOAuth/Messaging/ProtocolException.cs
@@ -45,6 +45,20 @@ namespace DotNetOAuth.Messaging {
/// such that it can be sent as a protocol message response to a remote caller.
/// </summary>
/// <param name="message">The human-readable exception message.</param>
+ /// <param name="faultedMessage">The message that was the cause of the exception. May not be null.</param>
+ internal ProtocolException(string message, IProtocolMessage faultedMessage) : base(message) {
+ if (faultedMessage == null) {
+ throw new ArgumentNullException("faultedMessage");
+ }
+
+ this.FaultedMessage = faultedMessage;
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ProtocolException"/> class
+ /// such that it can be sent as a protocol message response to a remote caller.
+ /// </summary>
+ /// <param name="message">The human-readable exception message.</param>
/// <param name="inResponseTo">
/// If <paramref name="message"/> is a response to an incoming message, this is the incoming message.
/// This is useful for error scenarios in deciding just how to send the response message.
@@ -61,6 +75,7 @@ namespace DotNetOAuth.Messaging {
throw new ArgumentNullException("inResponseTo");
}
this.inResponseTo = inResponseTo;
+ this.FaultedMessage = inResponseTo;
if (remoteIndirectReceiver == null && inResponseTo.Transport != MessageTransport.Direct) {
// throw an exception, with ourselves as the inner exception (as fully initialized as we can be).
@@ -100,7 +115,7 @@ namespace DotNetOAuth.Messaging {
#endregion
- #region IProtocolMessage Members
+ #region IProtocolMessage Properties
/// <summary>
/// Gets the version of the protocol this message is prepared to implement.
@@ -126,6 +141,18 @@ namespace DotNetOAuth.Messaging {
}
}
+ #endregion
+
+ /// <summary>
+ /// Gets the message that caused the exception.
+ /// </summary>
+ internal IProtocolMessage FaultedMessage {
+ get;
+ private set;
+ }
+
+ #region IProtocolMessage Methods
+
/// <summary>
/// See <see cref="IProtocolMessage.EnsureValidMessage"/>.
/// </summary>