Home | History | Annotate | Download | only in src
      1 
      2 #ifndef _XMLRPCEXCEPTION_H_
      3 #define _XMLRPCEXCEPTION_H_
      4 //
      5 // XmlRpc++ Copyright (c) 2002-2003 by Chris Morley
      6 //
      7 #if defined(_MSC_VER)
      8 # pragma warning(disable:4786)    // identifier was truncated in debug info
      9 #endif
     10 
     11 #ifndef MAKEDEPEND
     12 # include <string>
     13 #endif
     14 
     15 
     16 namespace XmlRpc {
     17 
     18   //! A class representing an error.
     19   //! If server methods throw this exception, a fault response is returned
     20   //! to the client.
     21   class XmlRpcException {
     22   public:
     23     //! Constructor
     24     //!   @param message  A descriptive error message
     25     //!   @param code     An integer error code
     26     XmlRpcException(const std::string& message, int code=-1) :
     27         _message(message), _code(code) {}
     28 
     29     //! Return the error message.
     30     const std::string& getMessage() const { return _message; }
     31 
     32     //! Return the error code.
     33     int getCode() const { return _code; }
     34 
     35   private:
     36     std::string _message;
     37     int _code;
     38   };
     39 
     40 }
     41 
     42 #endif	// _XMLRPCEXCEPTION_H_
     43