diff options
Diffstat (limited to '')
-rw-r--r-- | Common/XmlRpcCS/XmlRpcException.cs | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/Common/XmlRpcCS/XmlRpcException.cs b/Common/XmlRpcCS/XmlRpcException.cs new file mode 100644 index 0000000..fd1f4ae --- /dev/null +++ b/Common/XmlRpcCS/XmlRpcException.cs | |||
@@ -0,0 +1,39 @@ | |||
1 | namespace Nwc.XmlRpc | ||
2 | { | ||
3 | using System; | ||
4 | |||
5 | /// <summary>An XML-RPC Exception.</summary> | ||
6 | /// <remarks>Maps a C# exception to an XML-RPC fault. Normal exceptions | ||
7 | /// include a message so this adds the code needed by XML-RPC.</remarks> | ||
8 | public class XmlRpcException : Exception | ||
9 | { | ||
10 | private int _code; | ||
11 | |||
12 | /// <summary>Instantiate an <c>XmlRpcException</c> with a code and message.</summary> | ||
13 | /// <param name="code"><c>Int</c> faultCode associated with this exception.</param> | ||
14 | /// <param name="message"><c>String</c> faultMessage associated with this exception.</param> | ||
15 | public XmlRpcException(int code, String message) | ||
16 | : base(message) | ||
17 | { | ||
18 | _code = code; | ||
19 | } | ||
20 | |||
21 | /// <summary>The value of the faults message, i.e. the faultString.</summary> | ||
22 | public String FaultString | ||
23 | { | ||
24 | get { return Message; } | ||
25 | } | ||
26 | |||
27 | /// <summary>The value of the faults code, i.e. the faultCode.</summary> | ||
28 | public int FaultCode | ||
29 | { | ||
30 | get { return _code; } | ||
31 | } | ||
32 | |||
33 | /// <summary>Format the message to include the code.</summary> | ||
34 | override public String ToString() | ||
35 | { | ||
36 | return "Code: " + FaultCode + " Message: " + base.ToString(); | ||
37 | } | ||
38 | } | ||
39 | } | ||