namespace Nwc.XmlRpc
{
using System;
/// An XML-RPC Exception.
/// Maps a C# exception to an XML-RPC fault. Normal exceptions
/// include a message so this adds the code needed by XML-RPC.
public class XmlRpcException : Exception
{
private int _code;
/// Instantiate an XmlRpcException with a code and message.
/// Int faultCode associated with this exception.
/// String faultMessage associated with this exception.
public XmlRpcException(int code, String message)
: base(message)
{
_code = code;
}
/// The value of the faults message, i.e. the faultString.
public String FaultString
{
get { return Message; }
}
/// The value of the faults code, i.e. the faultCode.
public int FaultCode
{
get { return _code; }
}
/// Format the message to include the code.
override public String ToString()
{
return "Code: " + FaultCode + " Message: " + base.ToString();
}
}
}