~brianaker/libmemcached/merge-of-1.0

« back to all changes in this revision

Viewing changes to libtest/exception/disconnected.hpp

  • Committer: Continuous Integration
  • Date: 2013-05-04 09:21:59 UTC
  • mfrom: (1102.1.1 libmemcached-1.2)
  • Revision ID: ci@tangent.org-20130504092159-z0z9cm0gnu15wxs0
Merge lp:~tangent-org/libmemcached/1.2-build/ Build: jenkins-Libmemcached-297

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 *
3
3
 *  Data Differential YATL (i.e. libtest)  library
4
4
 *
5
 
 *  Copyright (C) 2012 Data Differential, http://datadifferential.com/
 
5
 *  Copyright (C) 2012-2013 Data Differential, http://datadifferential.com/
6
6
 *
7
7
 *  Redistribution and use in source and binary forms, with or without
8
8
 *  modification, are permitted provided that the following conditions are
36
36
 
37
37
#pragma once
38
38
 
39
 
#include <stdexcept>
 
39
#include "libtest/exception.hpp"
40
40
 
41
41
namespace libtest {
42
42
 
43
 
class disconnected : public std::runtime_error
 
43
class disconnected : public libtest::exception
44
44
{
45
45
public:
46
46
  disconnected(const char *file, int line, const char *func, const std::string&, const in_port_t port, ...);
47
47
 
48
 
  const char* what() const throw()
49
 
  {
50
 
    return _error_message;
51
 
  }
52
 
 
53
48
  disconnected(const disconnected&);
54
49
 
55
50
  // The following are just for unittesting the exception class
59
54
  static uint32_t disabled_counter();
60
55
  static void increment_disabled_counter();
61
56
 
62
 
  int line() const
63
 
  {
64
 
    return _line;
65
 
  }
66
 
 
67
 
  const char* file() const
68
 
  {
69
 
    return _file;
70
 
  }
71
 
 
72
 
  const char* func() const
73
 
  {
74
 
    return _func;
75
 
  }
76
 
 
77
57
private:
78
 
  char _error_message[BUFSIZ];
79
58
  in_port_t _port;
80
59
  char _instance[BUFSIZ];
81
 
  int _line;
82
 
  const char*  _file;
83
 
  const char* _func;
84
60
};
85
61
 
86
62
} // namespace libtest