XmlRpcException.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. namespace Nwc.XmlRpc
  2. {
  3. using System;
  4. /// <summary>An XML-RPC Exception.</summary>
  5. /// <remarks>Maps a C# exception to an XML-RPC fault. Normal exceptions
  6. /// include a message so this adds the code needed by XML-RPC.</remarks>
  7. public class XmlRpcException : Exception
  8. {
  9. private int _code;
  10. /// <summary>Instantiate an <c>XmlRpcException</c> with a code and message.</summary>
  11. /// <param name="code"><c>Int</c> faultCode associated with this exception.</param>
  12. /// <param name="message"><c>String</c> faultMessage associated with this exception.</param>
  13. public XmlRpcException(int code, String message)
  14. : base(message)
  15. {
  16. _code = code;
  17. }
  18. /// <summary>The value of the faults message, i.e. the faultString.</summary>
  19. public String FaultString
  20. {
  21. get { return Message; }
  22. }
  23. /// <summary>The value of the faults code, i.e. the faultCode.</summary>
  24. public int FaultCode
  25. {
  26. get { return _code; }
  27. }
  28. /// <summary>Format the message to include the code.</summary>
  29. override public String ToString()
  30. {
  31. return "Code: " + FaultCode + " Message: " + base.ToString();
  32. }
  33. }
  34. }