The Winamp Remote Control suite
a remote control client and plugin for Winamp 2.x, 5.x
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
RPCException.h
Go to the documentation of this file.
1 #ifndef RPCExceptionH
2 #define RPCExceptionH
3 
4 #include <string>
5 #include <exception>
6 
7 using namespace std;
8 
12 class ERPCException : public runtime_error
13 {
14 
15 public:
20  explicit ERPCException(int rpc_error_code) :
21  std::runtime_error("rpc runtime error"), what_("error message could not be formatted")
22  {
23 
24 
25  char buffer[255] = "";
26  int len = FormatMessageA( FORMAT_MESSAGE_FROM_SYSTEM,
27  NULL,
28  rpc_error_code,
29  LOCALE_USER_DEFAULT,
30  buffer,
31  sizeof(buffer),
32  NULL);
33 
34  if (len)
35  what_ = buffer;
36  }
37 
42  virtual const char* what() const throw ()
43  { return what_.c_str(); }
44 
45 
46 private:
47  std::string what_;
48 };
49 
50 #endif