ADTF  3.18.4
exception.h
1 /*************************************************************************
2  * libjson-rpc-cpp
3  *************************************************************************
4  * @file exception.h
5  * @date 31.12.2012
6  * @author Peter Spiess-Knafl <dev@spiessknafl.at>
7  * @license See attached LICENSE.txt
8  ************************************************************************/
9 
10 #ifndef JSONRPC_CPP_EXCEPTION_H_
11 #define JSONRPC_CPP_EXCEPTION_H_
12 
13 #include <string>
14 #include <sstream>
15 #include <exception>
16 
17 #include "errors.h"
18 
19 namespace jsonrpc
20 {
21  class JsonRpcException: public std::exception
22  {
23  public:
24  JsonRpcException(int code);
25  JsonRpcException(int code, const std::string& message);
26  JsonRpcException(int code, const std::string& message, const Json::Value &data);
27  JsonRpcException(const std::string& message);
28 
29  virtual ~JsonRpcException() throw ();
30 
31  int GetCode() const;
32  const std::string& GetMessage() const;
33  const Json::Value& GetData() const;
34 
35  virtual const char* what() const throw ();
36 
37  private:
38  int code;
39  std::string message;
40  std::string whatString;
41  Json::Value data;
42  void setWhatMessage();
43  };
44 
45 } /* namespace jsonrpc */
46 #endif /* JSONRPC_CPP_EXCEPTION_H_ */
Represents a JSON value.
Definition: value.h:177