~brianaker/libmemcached/1164440

« back to all changes in this revision

Viewing changes to libtest/fatal.hpp

  • Committer: Continuous Integration
  • Date: 2012-10-22 05:56:09 UTC
  • mfrom: (1086.1.8 libmemcached-1.0)
  • Revision ID: ci@tangent.org-20121022055609-cbooaw9bcdal4qge
Merge lp:~tangent-org/libmemcached/1.0-build Build: jenkins-Libmemcached-1.0-87

Show diffs side-by-side

added added

removed removed

Lines of Context:
53
53
 
54
54
namespace libtest {
55
55
 
56
 
class exception : public std::runtime_error
 
56
class fatal : std::runtime_error
57
57
{
58
58
public:
59
 
  exception(const char *, int, const char *);
60
 
 
61
 
  int line() const
62
 
  {
63
 
    return _line;
64
 
  }
65
 
 
66
 
  const char*  file() const
67
 
  {
68
 
    return _file;
69
 
  }
70
 
 
71
 
  const char* func() const
72
 
  {
73
 
    return _func;
 
59
  fatal(const char *file, int line, const char *func, const char *format, ...);
 
60
 
 
61
  const char* what() const throw()
 
62
  {
 
63
    return _error_message;
74
64
  }
75
65
 
76
66
  const char* mesg() const throw()
78
68
    return _error_message;
79
69
  }
80
70
 
81
 
 
82
 
protected:
83
 
  char _error_message[BUFSIZ];
84
 
 
85
 
private:
86
 
  const char*  _file;
87
 
  int _line;
88
 
  const char* _func;
89
 
};
90
 
 
91
 
class fatal : public exception
92
 
{
93
 
public:
94
 
  fatal(const char *file, int line, const char *func, const char *format, ...);
95
 
 
96
 
  const char* what() const throw()
97
 
  {
98
 
    return _error_message;
99
 
  }
100
 
 
101
71
  // The following are just for unittesting the exception class
102
72
  static bool is_disabled();
103
73
  static void disable();
105
75
  static uint32_t disabled_counter();
106
76
  static void increment_disabled_counter();
107
77
 
 
78
  int line()
 
79
  {
 
80
    return _line;
 
81
  }
 
82
 
 
83
  const char*  file()
 
84
  {
 
85
    return _file;
 
86
  }
 
87
 
 
88
  const char* func()
 
89
  {
 
90
    return _func;
 
91
  }
 
92
 
108
93
private:
 
94
  char _error_message[BUFSIZ];
 
95
  char _mesg[BUFSIZ];
 
96
  int _line;
 
97
  const char*  _file;
 
98
  const char* _func;
109
99
};
110
100
 
111
 
class disconnected : public exception
 
101
class disconnected : std::runtime_error
112
102
{
113
103
public:
114
104
  disconnected(const char *file, int line, const char *func, const std::string&, const in_port_t port, const char *format, ...);
125
115
  static uint32_t disabled_counter();
126
116
  static void increment_disabled_counter();
127
117
 
128
 
private:
129
 
  in_port_t _port;
130
 
  char _instance[1024];
131
 
};
132
 
 
133
 
class start : public exception
134
 
{
135
 
public:
136
 
  start(const char *file, int line, const char *func, const std::string&, const in_port_t port, const char *format, ...);
137
 
 
138
 
  const char* what() const throw()
139
 
  {
140
 
    return _error_message;
141
 
  }
142
 
 
143
 
  // The following are just for unittesting the exception class
144
 
  static bool is_disabled();
145
 
  static void disable();
146
 
  static void enable();
147
 
  static uint32_t disabled_counter();
148
 
  static void increment_disabled_counter();
149
 
 
150
 
private:
151
 
  in_port_t _port;
152
 
  char _instance[1024];
 
118
  int line()
 
119
  {
 
120
    return _line;
 
121
  }
 
122
 
 
123
  const char* file()
 
124
  {
 
125
    return _file;
 
126
  }
 
127
 
 
128
  const char* func()
 
129
  {
 
130
    return _func;
 
131
  }
 
132
 
 
133
private:
 
134
  char _error_message[BUFSIZ];
 
135
  in_port_t _port;
 
136
  char _instance[1024];
 
137
  int _line;
 
138
  const char*  _file;
 
139
  const char* _func;
153
140
};
154
141
 
155
142