1 | /* |
---|
2 | XML-RPC.NET library |
---|
3 | Copyright (c) 2001-2006, Charles Cook <charlescook@cookcomputing.com> |
---|
4 | |
---|
5 | Permission is hereby granted, free of charge, to any person |
---|
6 | obtaining a copy of this software and associated documentation |
---|
7 | files (the "Software"), to deal in the Software without restriction, |
---|
8 | including without limitation the rights to use, copy, modify, merge, |
---|
9 | publish, distribute, sublicense, and/or sell copies of the Software, |
---|
10 | and to permit persons to whom the Software is furnished to do so, |
---|
11 | subject to the following conditions: |
---|
12 | |
---|
13 | The above copyright notice and this permission notice shall be |
---|
14 | included in all copies or substantial portions of the Software. |
---|
15 | |
---|
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
---|
17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
---|
18 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
---|
19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
---|
20 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
---|
21 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
---|
22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
---|
23 | DEALINGS IN THE SOFTWARE. |
---|
24 | */ |
---|
25 | |
---|
26 | namespace CookComputing.XmlRpc |
---|
27 | { |
---|
28 | using System; |
---|
29 | #if (!COMPACT_FRAMEWORK) |
---|
30 | using System.Runtime.Serialization; |
---|
31 | #endif |
---|
32 | |
---|
33 | // used to return server-side errors to client code - also can be |
---|
34 | // thrown by Service implmentation code to return custom Fault Responses |
---|
35 | #if (!COMPACT_FRAMEWORK) |
---|
36 | [Serializable] |
---|
37 | #endif |
---|
38 | public class XmlRpcFaultException : ApplicationException |
---|
39 | { |
---|
40 | // constructors |
---|
41 | // |
---|
42 | public XmlRpcFaultException(int TheCode, string TheString) |
---|
43 | : base("Server returned a fault exception: [" + TheCode.ToString() + |
---|
44 | "] " + TheString) |
---|
45 | { |
---|
46 | m_faultCode = TheCode; |
---|
47 | m_faultString = TheString; |
---|
48 | } |
---|
49 | #if (!COMPACT_FRAMEWORK) |
---|
50 | // deserialization constructor |
---|
51 | protected XmlRpcFaultException( |
---|
52 | SerializationInfo info, |
---|
53 | StreamingContext context) |
---|
54 | : base(info, context) |
---|
55 | { |
---|
56 | m_faultCode = (int)info.GetValue("m_faultCode", typeof(int)); |
---|
57 | m_faultString = (String)info.GetValue("m_faultString", typeof(string)); |
---|
58 | } |
---|
59 | #endif |
---|
60 | // properties |
---|
61 | // |
---|
62 | public int FaultCode |
---|
63 | { |
---|
64 | get { return m_faultCode; } |
---|
65 | } |
---|
66 | |
---|
67 | public string FaultString |
---|
68 | { |
---|
69 | get { return m_faultString; } |
---|
70 | } |
---|
71 | #if (!COMPACT_FRAMEWORK) |
---|
72 | // public methods |
---|
73 | // |
---|
74 | public override void GetObjectData( |
---|
75 | SerializationInfo info, |
---|
76 | StreamingContext context) |
---|
77 | { |
---|
78 | info.AddValue("m_faultCode", m_faultCode); |
---|
79 | info.AddValue("m_faultString", m_faultString); |
---|
80 | base.GetObjectData(info, context); |
---|
81 | } |
---|
82 | #endif |
---|
83 | // data |
---|
84 | // |
---|
85 | int m_faultCode; |
---|
86 | string m_faultString; |
---|
87 | } |
---|
88 | } |
---|